Skip to content

[BUG] <Suggestion: Improve LinkedList Loop Detection Algorithm - Create, Detect, Remove> #4679

@AdityaRokade17

Description

@AdityaRokade17

Description

I noticed that the current loop detection algorithm in the LinkedList class is not efficient for large lists. I would like to suggest an improvement to make it more optimized. Easiest Code for the ones who is new for a coding and very easy to understand.
also added one more function if loop is detect it will remove loop and return.

Steps to reproduce

1.Create a linked list with a loop.
2.Run the loop detection algorithm.
3.Gives Error

Excepted behavior

I expected the loop detection algorithm to run efficiently and quickly identify the loop in the linked list and also need to have option to remove loop.

Screenshots

Screenshot (9)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions