Help Needed!!!

suprakashnandy's Avatar, Join Date: Sep 2007
Newbie Member
I want the solution of a linked list problem...The problem is :

I have a infinitely long Singly linked list and don't have any start and end pointer. There is a pointer p, pointing to a node somewhere in the linked list and i have to delete its previous node. Is it possible and if yes then how?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
As its single list you cannot reach the previous node unless its a cyclic single linked list.
0
An007kit's Avatar, Join Date: Oct 2007
Go4Expert Member
I am not sure what do ya mean by the fact infinitely long.....
Otherwise ya can work on the lines of shabbir...
check for a circular linked list....
that can be done by initialising two pointers and incrementing them at different interval...one at an increment of 1 other at an increment of 2...
if they meet....linked list is circular....
then ya can go to the previous node or previous to previous node and complete ur stuff....