Question: 4
(Choose 1 answer)
Suppose we are considering a doubly linked list and p is some node in the list which has both predecessor
and successor nodes.
Select the most correct java code snippet that deletes the node p.
A. Node p1,p2; p1 = p.prev;
p2 p1.next; p2.prev = p1;
p1.next=p2;
B. Node p1,p2; p1 = p.prev; // prev is a link to previous node
p2=p.next; p2.prev = p1;
p1.next=p2;
C. Node p1,p2; p1 = p.prev
p2=p.next; p2.prev = p1;
p1.next=p;
D. Node p1,p2; p1 = p.prev
p2=p.next; p2.prev = p;
p1.next = p2;