C FAQ - III
FAQ - III
Deleting a node from single linked list without knowing previous pointer :
You need to make a copy of the next node on the current node and then free the next node ;)
Detecting loops in linked list:
Use two pointers one that moves node by node and the other moves two nodes at a time, if these
pointers meet then a loop is detected.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home