Vidyalelo
Data Structure · Q95

Introduction to Data Structures

Programming · Data Structure · question 95

Q95

Consider the following doubly linked list: head-1-2-3-4-5-tail. What will be the list after performing the given sequence of operations? 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
Answer
D.
head-0-1-2-3-4-5-tail

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board