首页 > 其他 > 详细

reverse list链表逆序

时间:2016-04-03 21:49:02      阅读:247      评论:0      收藏:0      [点我收藏+]
 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 }

 

reverse list链表逆序

原文:http://www.cnblogs.com/co0oder/p/5350546.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!