单链表反转:1->2->3->4...
思路:先将1指向3,2指向1,结果为2->1->3->4,然后循环将3插入到2之前
<span style="font-size:18px;">void reverseLinkedList(List head) { List tmp,p; if(head==null) { return ; } tmp=head->next; while(tmp->next !=null){ p=tmp->next; tmp-next=p->next; p->next=head->next; head->next=p; } }</span>
原文地址:http://blog.csdn.net/tenderhearted/article/details/39669871