An alternate solution may be something like this:

You have two loops. one inside another.
node*temp1=start,*temp2=start;
node*loopingNode=null;

while(temp1) {
   while(temp2) {
      if(temp1->next=temp2->next) {
            loopingNode=temp1->next;
            break;
      }
      temp2=temp2->next;
   }
   if(loopingNode!=null)
      break;
   temp1=temp1->next;
}

On 4/4/07, Pradeep Juneja <[EMAIL PROTECTED]> wrote:
>
>
>
> How can we know at what node, list has the loop ?
> i.e
> A---->B----->*C*------->D------>E------F-----
>                         |                                               |
>                         ----------------------------- - -|
> >
>


-- 
Thanks & Regards,
Dhruva Sagar.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to