标签:
1 ListNode* reverseList(ListNode* head){ 2 if (head==NULL || head->next==NULL) return head; 3 ListNode *pre=head, *cur=pre->next, *post; 4 pre->next = NULL; 5 while (cur!=NULL){ 6 post = cur->next; 7 cur->next = pre; 8 pre = cur; 9 cur = post; 10 } 11 return pre; 12 }
标签:
原文地址:http://www.cnblogs.com/co0oder/p/5350546.html