Wednesday, April 13, 2011

Deleting current node in a singly linked list

Given a singly linked list with a pointer p pointing to some node(not the first or last node), how will you delete that node? You have no access to the head of the node

Solution:
Copy next node to current node and delete next node

No comments: