fix(searches): empty jump_search input; validate cyclic_sort - #15147
Open
felipeofdev-ai wants to merge 3 commits into
Open
fix(searches): empty jump_search input; validate cyclic_sort#15147felipeofdev-ai wants to merge 3 commits into
felipeofdev-ai wants to merge 3 commits into
Conversation
fix(sorts): validate cyclic_sort input to prevent infinite loops Fixes TheAlgorithms#15085 Fixes TheAlgorithms#14898
felipeofdev-ai
force-pushed
the
fix/jump-search-empty-list-and-cyclic-sort-validation
branch
from
September 1, 2026 14:37
c041e4b to
b80d47d
Compare
felipeofdev-ai
force-pushed
the
fix/jump-search-empty-list-and-cyclic-sort-validation
branch
from
September 1, 2026 14:45
10cfe92 to
2fb19fb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-1for empty sequences instead of raisingIndexError(Fixes bug(searches): jump_search raises IndexError for empty list input #15085).1..nbefore sorting; raiseValueErroron duplicates or out-of-range values to prevent infinite loops (Fixes cyclic_sort.py has no input validation, causes infinite loop on invalid input #14898).Test plan
python -m doctest searches/jump_search.py sorts/cyclic_sort.pyuvx ruff check sorts/cyclic_sort.py searches/jump_search.pyjump_search([], 5)returns-1cyclic_sort([1, 1, 2])raisesValueError