You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the algorithm
Floyd’s algorithm, also known as the Hare-Tortoise algorithm, is a pointer algorithm that uses only two pointers, moving through the sequence at different speeds. This algorithm is used to find a loop in a linked list. It uses two pointers one moving twice as fast as the other one. [The faster one is called the fast pointer and the other one is called the slow pointer]
While traversing the linked list one of these things will occur- The Fast pointer may reach the end (NULL) this shows that there is no loop in the linked list. [The Fast pointer again catches the slow pointer at some time therefore a loop exists in the linked list]
Title or Name of the Algorithm
*Floyd's Algorithm
Describe the algorithm
Floyd's algorithm is used for detection and removal of a cycle in a linked list
The text was updated successfully, but these errors were encountered: