We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I also got the same output. And I am not able to undrstand the input. My code:
boolhas_cycle(Node*head){if(head==NULL)returnfalse;if(head->next=head)returntrue;Node*slow=head;Node*fast=head->next;while(slow&&slow->next){if(slow==fast)returntrue;slow=slow->next;fast=fast->next->next;}returnfalse;// Complete this function// Do not write the main method}
Cycle Detection
You are viewing a single comment's thread. Return to all comments →
I also got the same output. And I am not able to undrstand the input. My code:
How to olve this issue?