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
Describe the bug
IntQuickSort.sort might move some elements from the range [left,right] to the range [0,left-1] during insertion sort. This results both undesired modification in range [0,left-1] and range [left,right] not being in order after the method returns.
Describe the bug
IntQuickSort.sort might move some elements from the range [left,right] to the range [0,left-1] during insertion sort. This results both undesired modification in range [0,left-1] and range [left,right] not being in order after the method returns.
To Reproduce
This prints
[1, 4, 2, 3]
instead of expected[4, 1, 2, 3]
.Possible solution
The bug seems to be the following line in IntQuickSort.insertionSort:
Instead of
i > -1
the comparison should bei >= left
.Environment:
The text was updated successfully, but these errors were encountered: