Updated comb_sort.cpp

This commit is contained in:
Uvaish Zafri 2021-02-11 20:53:16 +05:30
parent 9074443eab
commit 97896f852e

View File

@ -61,7 +61,7 @@ void CombSort(int *arr, int l, int r) {
swapped = false;
/// Compare all elements with current gap
for (int i = l; i <= r - gap; ++i) {
for (int i = l; i < r - gap; ++i) {
if (arr[i] > arr[i + gap]) {
std::swap(arr[i], arr[i + gap]);
swapped = true;