diff --git a/app/src/main/java/de/uni_marburg/powersort/sort/dpqs/DualPivotQuicksort.java b/app/src/main/java/de/uni_marburg/powersort/sort/dpqs/DualPivotQuicksort.java index ed95833..0d50d43 100644 --- a/app/src/main/java/de/uni_marburg/powersort/sort/dpqs/DualPivotQuicksort.java +++ b/app/src/main/java/de/uni_marburg/powersort/sort/dpqs/DualPivotQuicksort.java @@ -127,8 +127,8 @@ public final class DualPivotQuicksort { * @param pivotIndex2 the index of pivot2, the second pivot * @param po the method reference for the fallback implementation */ - private static int[] partition(A array, int high, int pivotIndex1, int pivotIndex2, PartitionOperation po) { - return po.partition(array, 0, high, pivotIndex1, pivotIndex2); + private static int[] partition(A array, int low, int high, int pivotIndex1, int pivotIndex2, PartitionOperation po) { + return po.partition(array, low, high, pivotIndex1, pivotIndex2); } /** @@ -279,7 +279,7 @@ public final class DualPivotQuicksort { * the pivots. These values are inexpensive approximation * of tertiles. Note, that pivot1 < pivot2. */ - int[] pivotIndices = partition(a, high, e1, e5, DualPivotQuicksort::partitionDualPivot); + int[] pivotIndices = partition(a, low, high, e1, e5, DualPivotQuicksort::partitionDualPivot); lower = pivotIndices[0]; upper = pivotIndices[1]; @@ -298,7 +298,7 @@ public final class DualPivotQuicksort { * Use the third of the five sorted elements as the pivot. * This value is inexpensive approximation of the median. */ - int[] pivotIndices = partition(a, high, e3, e3, DualPivotQuicksort::partitionSinglePivot); + int[] pivotIndices = partition(a, low, high, e3, e3, DualPivotQuicksort::partitionSinglePivot); lower = pivotIndices[0]; upper = pivotIndices[1]; /* diff --git a/app/src/test/java/de/uni_marburg/powersort/sort/AbstractSortTest.java b/app/src/test/java/de/uni_marburg/powersort/sort/AbstractSortTest.java index 99bbf0c..4802fcf 100644 --- a/app/src/test/java/de/uni_marburg/powersort/sort/AbstractSortTest.java +++ b/app/src/test/java/de/uni_marburg/powersort/sort/AbstractSortTest.java @@ -37,6 +37,7 @@ public abstract class AbstractSortTest { Integer[] array = AscendingRuns.newAscendingRuns(numOfRuns, runLength, decreaseBetweenRuns).getCopy(); sortAndCheckResult(array); } + @ParameterizedTest @CsvSource({ "2", @@ -49,7 +50,7 @@ public abstract class AbstractSortTest { sortAndCheckResult(array); } - void sortAndCheckResult(Integer[] array){ + void sortAndCheckResult(Integer[] array) { Integer[] expected = Arrays.copyOf(array, array.length); Arrays.sort(expected); diff --git a/app/src/test/java/de/uni_marburg/powersort/sort/DualPivotQuicksort.java b/app/src/test/java/de/uni_marburg/powersort/sort/DualPivotQuicksort.java deleted file mode 100644 index 7824ad6..0000000 --- a/app/src/test/java/de/uni_marburg/powersort/sort/DualPivotQuicksort.java +++ /dev/null @@ -1,7 +0,0 @@ -package de.uni_marburg.powersort.sort; - -public class DualPivotQuicksort extends AbstractSortTest { - DualPivotQuicksort() { - sortAlg = SortEnum.DPQS; - } -} diff --git a/app/src/test/java/de/uni_marburg/powersort/sort/DualPivotQuicksortTest.java b/app/src/test/java/de/uni_marburg/powersort/sort/DualPivotQuicksortTest.java new file mode 100644 index 0000000..1264661 --- /dev/null +++ b/app/src/test/java/de/uni_marburg/powersort/sort/DualPivotQuicksortTest.java @@ -0,0 +1,7 @@ +package de.uni_marburg.powersort.sort; + +public class DualPivotQuicksortTest extends AbstractSortTest { + DualPivotQuicksortTest() { + sortAlg = SortEnum.DPQS; + } +}