LucasPilla / Sorting-Algorithms-Visualizer

Program made with Python and Pygame module for visualizing sorting algorithms
MIT License
426 stars 164 forks source link

fixed TimSort algorithm bug #181

Closed idomeisner closed 11 months ago

idomeisner commented 11 months ago

There is a problem with the TimSort algorithm as described here: fix #180

The problem is that in several places there was an unnecessary indentation.

for example:

    while n >= RUN_LEN:
        last_bit |= n & 1
        n >>= 1
        return n + last_bit

instead of:

    while n >= RUN_LEN:
        last_bit |= n & 1
        n >>= 1
    return n + last_bit

Things I also did: