mirror of
https://gitlab.uni-marburg.de/langbeid/powersort.git
synced 2025-01-22 19:55:44 +01:00
Fixed order of merges of the remaining stack
This commit is contained in:
parent
1aaac3729e
commit
db340a89a3
@ -33,7 +33,7 @@ public class FinnSort {
|
|||||||
i = j;
|
i = j;
|
||||||
}
|
}
|
||||||
while (runs.size() >= 2) {
|
while (runs.size() >= 2) {
|
||||||
basicMerge(a, runs.removeFirst(), runs.removeFirst());
|
basicMerge(a, runs.removeLast(), runs.removeLast());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,10 +70,11 @@ public class FinnSort {
|
|||||||
}
|
}
|
||||||
int n_1 = run1.end - run1.start;
|
int n_1 = run1.end - run1.start;
|
||||||
int n_2 = run2.end - run2.start;
|
int n_2 = run2.end - run2.start;
|
||||||
double a = ((double) run1.start + 0.5 * n_1 - 1) / n;
|
double a = ((double) run1.start + 0.5d * n_1 - 1d) / n;
|
||||||
double b = ((double) run2.start + 0.5 * n_2 - 1) / n;
|
double b = ((double) run2.start + 0.5d * n_2 - 1d) / n;
|
||||||
int l = 0;
|
int l = 0;
|
||||||
while ((int) (a * pow(2, l)) == (int) (b * pow(2 ,l))) {
|
while ((int) (a * pow(2, l)) == (int) (b * pow(2 ,l))) {
|
||||||
|
|
||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
return l;
|
return l;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user