单链表的反转
1 Node *list_reverse(Node *head) { 2 if(NULL == head) { 3 return NULL; 4 } 5 Node *prev,*curr,*reverse_head,*temp; 6 prev=NULL,curr=head; 7 while(curr->next) { 8 temp=curr->next; 9 curr->next=prev; 10 prev=curr; 11 curr=temp; 12 } 13 curr->next=prev; 14 reverse_head=curr; 15 return reverse_head; 16 }