From c11238ea8b4a8d9e1fbd0f31750b849e13204f56 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Mon, 25 Nov 2024 12:40:06 +0000 Subject: [PATCH] add PowerSort interface --- .../de/uni_marburg/powersort/PowerSort.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/src/main/java/de/uni_marburg/powersort/PowerSort.java diff --git a/app/src/main/java/de/uni_marburg/powersort/PowerSort.java b/app/src/main/java/de/uni_marburg/powersort/PowerSort.java new file mode 100644 index 0000000..7c7f5fc --- /dev/null +++ b/app/src/main/java/de/uni_marburg/powersort/PowerSort.java @@ -0,0 +1,26 @@ +package de.uni_marburg.powersort; + +import java.util.Comparator; + +class PowerSort { + /** + * Sorts the given range, using the given workspace array slice + * for temp storage when possible. This method is designed to be + * invoked from public methods (in class Arrays) after performing + * any necessary array bounds checks and expanding parameters into + * the required forms. + * + * @param a the array to be sorted + * @param lo the index of the first element, inclusive, to be sorted + * @param hi the index of the last element, exclusive, to be sorted + * @param c the comparator to use + * @param work a workspace array (slice) + * @param workBase origin of usable space in work array + * @param workLen usable size of work array + * @since 1.8 + */ + static void sort(T[] a, int lo, int hi, Comparator c, + T[] work, int workBase, int workLen) { + assert c != null && a != null && lo >= 0 && lo <= hi && hi <= a.length; + } +} \ No newline at end of file