-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Closed
Labels
Description
C-Plus-Plus/sorting/comb_sort.cpp
Line 64 in e62e94d
| for (int i = l; i <= r - gap; ++i) { |
should be i < r - gap, otherwise, when i = r - gap, arr[i + gap] will be index out of bound.
btw, swapped flag seems to be redundant here in while (gap != 1 || swapped) {}, no matter swapped is true or false, loop ends when gap == 1