i need write a program to check if a list is acyclic, which means that a travel from any node in the list must not come back to the node itself.
a node is a struct type defined like that
but i am not allowed to allocate memory proportional to the list size and i even don't know the list size.Code:struct Node{ int data; Node *next; };
i now have no idea to do it, can anything give me a hand, please?