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"

No comments:

Post a Comment