Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Help Needed!!! (http://www.go4expert.com/forums/help-needed-t6587/)

suprakashnandy 28Sep2007 16:34

Help Needed!!!
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?

shabbir 28Sep2007 17:08

Re: Help Needed!!!
As its single list you cannot reach the previous node unless its a cyclic single linked list.

An007kit 2Oct2007 23:48

Re: Help Needed!!!
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....

All times are GMT +5.5. The time now is 16:16.