Algorithm to detect and remove loop in a Linked List

Problem Description: Given a Linked list, find out whether it contains a loop or not. If it does, then remove the loop and make the last node point to NULL.


In a linked list, a loop is encountered when the last node points to any node in the linked list instead of pointing to NULL.


For eg:


loop-1


To solve this problem, we need to follow these 2 steps:



Detecting whether a loop is present or not.
Removing the loop.

Detecting a loop in Linked List :

The fastest method to detect a loop in a linked list ...

 •  0 comments  •  flag
Share on Twitter
Published on November 09, 2020 03:57
No comments have been added yet.