Showing posts with label linked list. Show all posts
Showing posts with label linked list. Show all posts

Thursday, May 20, 2010

Delete any node in the middle of a linked list

Question

Given a pointer to a node in the middle of a linked list, how will you delete the present node ?

Answer
  
  The trick is in using simple pointer tricks. The "present node" should now point to the "next node". Make sure you delete the data in the "present node"