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

[FEATURE REQUEST] <title>Adding Hare and Tortoise Algorithm #5693

Open
Bhumika-00 opened this issue Oct 10, 2024 · 3 comments
Open

[FEATURE REQUEST] <title>Adding Hare and Tortoise Algorithm #5693

Bhumika-00 opened this issue Oct 10, 2024 · 3 comments

Comments

@Bhumika-00
Copy link

What would you like to Propose?

I would like to contribute Hare and Tortoise Algorithm as it is one of the most important concept when it comes to linked list

Issue details

I will add the algorithm in the linked list part

Additional Information

No response

@ANkurNagila
Copy link

Hello Bhumika

I am working on the issue and will be adding the Algorithm in the Linked List Section.

@ba-00001
Copy link

ba-00001 commented Oct 11, 2024

What would you like to propose?
I would like to propose the addition of the "Hare and Tortoise Algorithm" (also known as Floyd’s cycle detection algorithm) to the repository. This algorithm is useful for detecting cycles in a sequence, particularly in linked lists. Implementing this in Java would be a valuable addition to the existing algorithms in the repository.

Issue details
The Hare and Tortoise algorithm works by having two pointers move through the sequence at different speeds: one (the hare) moves two steps at a time, while the other (the tortoise) moves one step at a time. If there is a cycle, the two pointers will eventually meet. This algorithm is commonly used in problems involving linked lists to detect cycles efficiently, with O(n) time complexity and O(1) space complexity.

Additional Information
The proposed implementation will include both a standard use case for detecting a cycle in a linked list and a brief explanation of its time and space complexity. The code will follow Java best practices and will include comprehensive test cases to ensure functionality and correctness. This algorithm is widely recognized and often appears in technical interviews, making it a valuable resource for learners and developers.

[FEATURE REQUEST] Adding Hare and Tortoise Algorithm #5693
#5693

@Bhumika-00
Copy link
Author

Bhumika-00 commented Oct 11, 2024 via email

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

3 participants