How do I convert my code to bool because there is no pre defined function to detect the cycle
void floydCycleRemoval(Node head)
{
Nodeslow=head;
Node*fast=head;
do{
slow=slow->next;
fast=fast->next->next;
}
while(slow!=fast);
fast=head;
while(slow->next!=fast->next){
fast=fast->next;
slow=slow->next;
}
slow->next=NULL;
}
Cycle detection and removal
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.