This is fine but adding a twist to it. Find number of nodes which are not in the loop.
On Wed, Aug 31, 2011 at 6:27 PM, rahul sharma <rahul23111...@gmail.com>wrote: > int loop(void *head1,void *head2) > { > //head1 and head2 initialized to start; > while(head1!=NULL && head2!=NULL) > { > head1=head1->next; > head2=head2->next->next; > if(head1==head2) > return 1;////tehre is loop; > } > return 0;//no loop > } > > > > hi guys is it corect for finding the loop...if any test case that wont > works here plz tell... > > -- > 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 > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.