Friday, July 18, 2008

Given a pointer to a node in a single linked list how do you delete it?

Technique:
Copy the contents of next node into the current node and then do the following things:
1) copy the next pointer into a temporary pointer
2) set current node's next to next node's next
3) delete the node pointed by temporary pointer.

No comments: