Sir, please help me to find my error
sir, i did it in line number 129.
but, still my answer in incorrect
did u modify prewritten code ?
i copied ur logic in the given template and it is working fine.
check here->

their print function is different.
yes sir, i did some modification. i write two functions. one for checking the cycle present and other for removing the cycle. i also modified in print function the LL . here is my code-> https://ide.codingblocks.com/s/465071
Sir, please help to find out my mistake in my code.
use this print function rest is correct .
void printLinkedList(Node *head)
{
unordered_set<int> s;
while (head != NULL)
{
if (s.find(head->data) != s.end())
{
cout << "\nCycle detected at " << head->data;
return;
}
cout << head->data << " ";
s.insert(head->data);
head = head->next;
}
}
ur updated code ->
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.