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

Prevent is_circular function from infinite loop #179

Merged
merged 2 commits into from
Apr 1, 2024

Commits on Mar 28, 2024

  1. Fix the is_circular function

    Transform the is_circular function by shifting from a single
    pointer approach to employing slow and fast pointers. The
    single pointer method falls short in detecting loops that
    occur mid-list without additional storage. Utilizing slow
    and fast pointers overcomes this limitation, enabling
    the detection of mid-list loops. Although this approach
    introduces a slight increase in conditional checks, it remains
    a superior method for loop detection without the need for extra storage.
    wilson20010327 committed Mar 28, 2024
    Configuration menu
    Copy the full SHA
    7bb7862 View commit details
    Browse the repository at this point in the history
  2. Remove useless parentheses

    To follow the coding style, remove the usless parentheses.
    wilson20010327 committed Mar 28, 2024
    Configuration menu
    Copy the full SHA
    bc0d83a View commit details
    Browse the repository at this point in the history