codeing
链表
单链表反转
public static Node reverselinkdlist(Node head){Node pre = null;Node next = null;if(head!=null){while (head!=null){next = head.next;head.next = pre;pre = head;head = next;}}return pre;}
双向链表翻转
public static Node reverselinkdlist(Node head){Node pre = null;Node next = null;if(head!=null){while (head!=null){next = head.next;head.next = pre;head.pre = next;pre =head;head = next;}}return pre;}
