fix(sorts): raise ValueError for negative inputs in radix_sort (#14950) - #14986
Open
TheRodzz wants to merge 1 commit into
Open
fix(sorts): raise ValueError for negative inputs in radix_sort (#14950)#14986TheRodzz wants to merge 1 commit into
TheRodzz wants to merge 1 commit into
Conversation
Author
|
pre-commit.ci run |
…gorithms#14950) This commit updates `radix_sort()` to validate that all integers in `list_of_ints` are non-negative. Radix sort relies on digit-by-digit sorting and only supports non-negative integers. If any negative integer is present in `list_of_ints`, `radix_sort()` now raises a `ValueError`. Empty list input is also handled gracefully. Additionally, pre-commit noqa annotations are updated where needed. Fixes TheAlgorithms#14950
TheRodzz
force-pushed
the
fix-radix-sort-negative-inputs
branch
from
August 5, 2026 17:18
0b236ee to
509c795
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.
Describe your change:
Fixes #14950
Adds validation to
radix_sort()to raise aValueErrorwhen negative integers are passed inlist_of_ints(as radix sort only supports non-negative integers), and handles empty lists gracefully.Checklist: