bool floydCycleRemoval(Node *&head)
{
Node *slow = head, *fast = head;
while(slow!=fast){
fast = fast->next->next;
slow = slow->next;
if(fast==NULL or fast->next==NULL){
return false;
}
}
fast = head;
while(slow->next != fast->next){
slow = slow->next;
fast = fast->next;
}
slow->next = NULL;
return true;
}
Cycle is not removing (Floyd algorithm)
hi @hpant7563_8b950b13f3de9913 what is the error u r getting and please save the code on ide.codingblocks.com
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.