bool has_cycle(Node* head) { if(head==NULL) return 0; Node *slow=head, *fast=head; while(fast!=NULL && fast->next!=NULL) { slow=slow->next; fast=fast->next->next; if(slow==fast) return 1; } return 0; }
lasamyoba Mike Allen https://wakelet.com/wake/y-sJFCbXZE_-9NscpxqoS tsonjalassco
OelmenYmons-ne Joshua Ramu AwesomeClick here obprazbercand
lasamyoba Mike Allen https://wakelet.com/wake/y-sJFCbXZE_-9NscpxqoS
ReplyDeletetsonjalassco
OelmenYmons-ne Joshua Ramu Awesome
ReplyDeleteClick here
obprazbercand