Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent is_circular from infinite loop (#179)
This commit refines the is_circular() to use slow and fast pointers instead of a single pointer iteration. The original approach struggled to detect mid-list loops without extra storage. The new method effectively identifies such loops, albeit with a minor increase in conditional checks, but without requiring additional storage.
- Loading branch information