Floyd cycle detection and removal problem
Hey @jha.aparna17
while(f!=NULL && f->next!=NULL)
{
f=f->next->next;//Do this before cehcking cond
s=s->next;//Do this before
if(s==f)
{
s=head;
while(s->next!=f->next)
{
s=s->next;
f=f->next;
}
f->next=NULL;
return true;
}
// else removed this part
// {
// }
}
Otherwise f and s will always be equal to head in 1st iteration