add PowerSort interface

This commit is contained in:
Daniel Langbein 2024-11-25 12:40:06 +00:00
parent 01db748f3e
commit c11238ea8b
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002

View File

@ -0,0 +1,26 @@
package de.uni_marburg.powersort;
import java.util.Comparator;
class PowerSort<T> {
/**
* 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 <T> void sort(T[] a, int lo, int hi, Comparator<? super T> c,
T[] work, int workBase, int workLen) {
assert c != null && a != null && lo >= 0 && lo <= hi && hi <= a.length;
}
}