编码实现链表逆序
时间:2015-04-03 11:22:47
收藏:0
阅读:152
Node Reverse(Node head){
if(head == NULL)
return head;
Node pre,cur,ne;
pre = head;
cur = head->next;//当前要逆转结点
while(cur){
ne = cur->next;
cur->next = pre;
pre =cur;
cur = ne;
}
head->next = NULL;
head = pre;
return head;
}原文:http://blog.csdn.net/sxhlovehmm/article/details/44851427
评论(0)