UTSAVS26 / PyVerse

PyVerse is an open-source collection of diverse Python projects, tools, and scripts, ranging from beginner to advanced, across various domains like machine learning, web development, and automation.
https://sites.google.com/view/pyverse-python-universe/
MIT License
68 stars 196 forks source link

[Code Addition Request]: addition of linked list cycle detection algorithm #897

Open SKG24 opened 2 days ago

SKG24 commented 2 days ago

Have you completed your first issue?

Guidelines

Latest Merged PR Link

https://github.com/UTSAVS26/PyVerse/pull/891#event-14950590185

891

Project Description

Problem Statement:

Given the head of a linked list, determine if the list contains a cycle. A cycle occurs if a node in the list points back to a previous node, allowing traversal to loop indefinitely.

Solution Approach Using Slow and Fast Pointers:

To detect a cycle, we use two pointers, slow and fast, that traverse the list at different speeds:

This two-pointer technique efficiently detects cycles in O(n) time complexity without extra space.

Full Name

Sanat Kumar Gupta @skg24

Participant Role

gssoc-ext, hacktoberfest

github-actions[bot] commented 2 days ago

🙌 Thank you for bringing this issue to our attention! We appreciate your input and will investigate it as soon as possible.

Feel free to join our community on Discord to discuss more!

SKG24 commented 2 days ago

please assign this to me! thank you!