Find start node of loop in Singly LinkedList in java?

By | June 22, 2020

In a couple of previous Posts, We already went through the Singly Linked List Problem statements:

Implementing a Circular Singly Linked List in Java ? 
How to check whether a linked list has a loop/cycle in java ?

In this post, We will learn How to find start a node of loop in Singly LinkedList in java?

The logic used in this Program:

  • First of all, we have to find a meeting point of slowReference and fastReference.
  • Next Step to set slowReference to head node of LinkedList.
  • Afterward move slowReference and fastReference both by one node at a time
  • The node at which slowReference and fastReference meets that will be starting node of the loop.

Below is the complete source code:

Output of this Program:

Start node of loop in Singly LinkedList = 40

You May Also Like:

That’s all about Find start node of loop in Singly LinkedList in java?
If you have any feedback or suggestion please feel free to drop in below comment box.

Leave a Reply

Your email address will not be published. Required fields are marked *