Page 1 of 1

Consider the following doubly linked list: head-1-2-3-4-5-tail. What will be the list after performing the given sequenc

Posted: Wed Jul 13, 2022 7:41 pm
by answerhappygod
Node temp = new Node(6,head,head.getNext());
Node temp1 = new Node(0,tail.getPrev(),tail);
head.setNext(temp);
temp.getNext().setPrev(temp);
tail.setPrev(temp1);
temp1.getPrev().setNext(temp1);
a) head-0-1-2-3-4-5-6-tail
b) head-1-2-3-4-5-6-tail
c) head-6-1-2-3-4-5-0-tail
d) head-0-1-2-3-4-5-tail