链表反转
1 Node * reverse(Node * head) 2 { 3 if(head == NULL) 4 return NULL; 5 Node * curr = head; 6 Node * next = head->link; 7 Node * nnext; 8 while(next) 9 { 10 nnext = next->link; 11 next->link = curr; 12 curr = next; 13 next = nnext; 14 } 15 return curr; 16 }
posted on 2013-11-17 22:18 zcranberry 阅读(103) 评论(0) 编辑 收藏 举报