getting run time error please let me know about the mistakes that i have made.
💡 Circular Linked List
Hello @WARHEAD,
The logic that you have applied to detect and delete loop would not work in the linked you have created.
Reason:
The linked list is linear. There is no loop.
Solution:
-
Either you can check for the element after which elements starts repeating in your linear linked list and remove the loop.
-
You can create a loop while inserting elements in your linked list and then apply the logic of two pointers to detect and remove the loop.
You can refer to this code i have corrected earlier:
https://ide.codingblocks.com/s/161841
Hope, this would help.
Give a like if you are satisfied.
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.