this code is not giving me correct output
Circular Linked List
Hi @MG7
Your code is giving wrong answer because you are not creating loop in linked list and hence detect loop function is not able to remove the loop.
I didn’t got what you are saying please explain in detail
What you need to do is that you have to first create a loop from the array that is given in input. For example :
if array is given as 1 2 3 4 5 2 3 4 5 then when you see that after 5 you encounter 2 which is already present then you have to make 5->next = 2; this is how you have to make loop. Then you have to detect this loop and remove it.
Can you please send me the code of making loop because I am facing difficulty in it.