逆转链表
public static ListNode ReverseList2(ListNode head){
if(head == null){
return null;
}
if(head.next == null){
return head;
}
ListNode q = head.next;
ListNode p = q.next;
//执行第一次交换
q.next = head;
head.next = null;
while (p.next!=null){
head = q;
q = p;
p = p.next;
q.next = head;
}
p.next = q;
return p;
}