a)
b)
If "n" is the node to be removed then do the following operations:
1) n.prev.next = n.next
2) n.next.prev = n.prev
Now the node n is not reachable by the linked list and hence had
been removed from the linked list.
c) Since n.prev.next = n.next and
n.next.prev = n.prev are the only 2 operations to
be done to remove a node in between the head and end of any linked
list, the complexity is constant (i.e.) O(1)
Get Answers For Free
Most questions answered within 1 hours.