mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-02 18:20:21 +08:00
Updated comb_sort.cpp
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user