mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
fix: Revert comb_sort
changes
This commit is contained in:
parent
0356a9cdf3
commit
0767af4a0d
@ -14,7 +14,7 @@ int FindNextGap(int x) {
|
|||||||
return std::max(1, x);
|
return std::max(1, x);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CombSort(int b[], int l, int r) {
|
void CombSort(int a[], int l, int r) {
|
||||||
// Init gap
|
// Init gap
|
||||||
int gap = n;
|
int gap = n;
|
||||||
|
|
||||||
@ -30,8 +30,8 @@ void CombSort(int b[], int l, int r) {
|
|||||||
|
|
||||||
// Compare all elements with current gap
|
// Compare all elements with current gap
|
||||||
for (int i = l; i <= r - gap; ++i) {
|
for (int i = l; i <= r - gap; ++i) {
|
||||||
if (b[i] > b[i + gap]) {
|
if (a[i] > a[i + gap]) {
|
||||||
std::swap(b[i], b[i + gap]);
|
std::swap(a[i], a[i + gap]);
|
||||||
swapped = true;
|
swapped = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user