双链表反转
public static DoubleNode reverseLinklist(DoubleNode head){ DoubleNode pre=null; //p引用(指针)指向null DoubleNode next=null; while (head!=null){ next=head.next; //next指针指向head.next指向的位置 head.next=pre; //head.next指针指向pre指向的位置 head.last=next; pre=head; head=next; } return pre; //返回head引用(指针) }

浙公网安备 33010602011771号