diptangsu / diptangsu/Sorting-Algorithms

Timsort.py gets IndexError on larger arrays

Open
#205 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
171
Forks
165
PR merge metrics
No merged PRs in 30d

Description

Also left and right seem to be swapped, result works just nomenclature.

> len1, len2 = m - l + 1, r - m
> if l + len1 > len(arr):
> len1 = len(arr) - l

Contributor guide

Open the contributing guide

Research direction

Start with Timsort.py and inspect the merge logic around the len1 and len2 calculations shown in the report. Reproduce the failure with a larger array, then verify that the adjusted bounds prevent IndexError and that the resulting array remains sorted.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.