Commit 509c795
committed
fix(sorts): raise ValueError for negative inputs in radix_sort (#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 #149501 parent f5988cc commit 509c795
2 files changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
| 454 | + | |
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
25 | 35 | | |
26 | 36 | | |
27 | 37 | | |
| |||
0 commit comments