Examveda

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

D. head-0-1-2-3-4-5-tail

Answer: Option C


This Question Belongs to Data Structure >> Introduction To Data Structures

Join The Discussion

Related Questions on Introduction to Data Structures