Cycle Removal and removal in linked list


What’s wrong this code?

hello @Shashank-Shekhar-2351214838461151
image
this is now correct.

first u need the starting point of the cycle.
and it is not necessary that slow is that point.

so do this in ur while loop.
while(ptr->next!=head->next){
ptr=ptr->next;
head=head->next;
}
ptr->next=NULL;

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.