You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: bubble sort no longer fails on reversed array
A corner case in the end condition of bubble sort meant that if the
array ever got to a state where the unsorted subarray is size 2 and out
of order, i.e. _end = 2 AND array[0] > array[1] (starting with a
reversed array will lead to this condition), the next iteration will
have _index equal _end, missing the end condition entirely and
eventually causing a crash when the player goes outside the array
bounds.
0 commit comments