Computer Science, asked by Shubhambattan183, 1 year ago

Given a circular linked list, implement an algorithm which returns node at the beginning of the loop.

Answers

Answered by choudhary21
0

Explanation:

Also referred to as the “Tortoise and Hare Algorithm”, the solution uses a fast pointer (traversing the list two items at a time) and a slow pointer (traversing the list one item at a time).

If there is a loop, then the fast pointer will go around the loop twice as fast as the slow pointer.

Answered by Anonymous
1

Explanation:

Find first node of loop in a linked list. Write a function findFirstLoopNode() that checks whether a given Linked List contains loop. If loop is present then it returns point to first node of lo

Similar questions