Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floyd's Algorithm #336

Open
codebloded opened this issue Jan 21, 2021 · 1 comment
Open

Floyd's Algorithm #336

codebloded opened this issue Jan 21, 2021 · 1 comment

Comments

@codebloded
Copy link

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

@shivanshu814
Copy link

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

Floyd's Algorithm #336

Title of the Algorithm
Floyd's Algorithm

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants