Repository commit
b3f113d
Python version (python --version)
Python 3.14.7
Dependencies version (pip freeze)
Not applicable — no third-party dependencies are required. The reproduction uses only Python’s standard library.
Expected behavior
The intro_sort() helper in sorts/intro_sort.py should sort only the
half-open range [start:end], leaving elements outside that range unchanged,
including when it switches to heap sort.
Reproduction:
from sorts.intro_sort import intro_sort
values = [100, 4, 3, 2, 1, -100]
result = intro_sort(values, start=1, end=5, size_threshold=2, max_depth=0)
print(result)
Expected output:
Only indices 1 through 4 are requested to be sorted. Setting max_depth=0
forces the heap-sort fallback.
Actual behavior
Actual output:
The heap-sort fallback calls heap_sort(array) on the entire list, ignoring
start and end. Consequently, elements outside the requested range move.
This report concerns range handling in the intro_sort() helper. It does
not demonstrate incorrect whole-list ordering from the public sort() function.
Repository commit
b3f113d
Python version (python --version)
Python 3.14.7
Dependencies version (pip freeze)
Not applicable — no third-party dependencies are required. The reproduction uses only Python’s standard library.
Expected behavior
The
intro_sort()helper insorts/intro_sort.pyshould sort only thehalf-open range
[start:end], leaving elements outside that range unchanged,including when it switches to heap sort.
Reproduction:
Expected output:
Only indices 1 through 4 are requested to be sorted. Setting
max_depth=0forces the heap-sort fallback.
Actual behavior
Actual output:
The heap-sort fallback calls
heap_sort(array)on the entire list, ignoringstartandend. Consequently, elements outside the requested range move.This report concerns range handling in the
intro_sort()helper. It doesnot demonstrate incorrect whole-list ordering from the public
sort()function.