链表-反转双向链表

//反转双向链表
public class DoubleNode{
    public int value;
    public DoubleNode last;
    public DoubleNode next
    public DoubleNode(int data){
        this.data.data;
    }
}
public DoubleNode reverseDoubleLinkedList(DoubleNode head){
    DoubleNode pre=null;
    DoubleNode next=null;
    while(head!=null){
        next=head.next;
        head.next=pre;
        head.last=next;
        pre=head;
        head=next;
    }
    return pre;
}

猜你喜欢

转载自blog.csdn.net/weixin_42146769/article/details/88381698