Class Partition
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
partitionSubList
(int i, int j, byte[] values) Partition a subarray ofvalues
.static int
partitionSubList
(int i, int j, char[] values) Partition a subarray ofvalues
.static int
partitionSubList
(int i, int j, double[] values) Partition a subarray ofvalues
.static int
partitionSubList
(int i, int j, float[] values) Partition a subarray ofvalues
.static int
partitionSubList
(int i, int j, int[] values) Partition a subarray ofvalues
.static int
partitionSubList
(int i, int j, long[] values) Partition a subarray ofvalues
.static int
partitionSubList
(int i, int j, short[] values) Partition a subarray ofvalues
.static <T extends Comparable<T>>
intpartitionSubList
(int i, int j, List<T> values) Partition a sublist ofvalues
.static <T extends Comparable<T>>
intpartitionSubList
(int i, int j, List<T> values, int[] permutation) Partition a sublist ofvalues
.static <T> int
partitionSubList
(int i, int j, List<T> values, int[] permutation, Comparator<? super T> compare) Partition a sublist ofvalues
.static <T> int
partitionSubList
(int i, int j, List<T> values, Comparator<? super T> compare) Partition a sublist ofvalues
.static <T extends Comparable<T>>
voidpartitionSubList
(ListIterator<T> i, ListIterator<T> j) Partition a sublist.static <T extends Comparable<T>>
voidpartitionSubList
(ListIterator<T> i, ListIterator<T> j, int[] permutation) Partition a sublist.static <T> void
partitionSubList
(ListIterator<T> i, ListIterator<T> j, int[] permutation, Comparator<? super T> compare) Partition a sublist.static <T> void
partitionSubList
(ListIterator<T> i, ListIterator<T> j, Comparator<? super T> compare) Partition a sublist.
-
Constructor Details
-
Partition
public Partition()
-
-
Method Details
-
partitionSubList
public static int partitionSubList(int i, int j, byte[] values) Partition a subarray ofvalues
. The element at indexj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.- Parameters:
i
- index of first element of subarrayj
- index of last element of subarrayvalues
- array- Returns:
- index of pivot element
-
partitionSubList
public static int partitionSubList(int i, int j, short[] values) Partition a subarray ofvalues
. The element at indexj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.- Parameters:
i
- index of first element of subarrayj
- index of last element of subarrayvalues
- array- Returns:
- index of pivot element
-
partitionSubList
public static int partitionSubList(int i, int j, int[] values) Partition a subarray ofvalues
. The element at indexj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.- Parameters:
i
- index of first element of subarrayj
- index of last element of subarrayvalues
- array- Returns:
- index of pivot element
-
partitionSubList
public static int partitionSubList(int i, int j, long[] values) Partition a subarray ofvalues
. The element at indexj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.- Parameters:
i
- index of first element of subarrayj
- index of last element of subarrayvalues
- array- Returns:
- index of pivot element
-
partitionSubList
public static int partitionSubList(int i, int j, float[] values) Partition a subarray ofvalues
. The element at indexj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.- Parameters:
i
- index of first element of subarrayj
- index of last element of subarrayvalues
- array- Returns:
- index of pivot element
-
partitionSubList
public static int partitionSubList(int i, int j, double[] values) Partition a subarray ofvalues
. The element at indexj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.- Parameters:
i
- index of first element of subarrayj
- index of last element of subarrayvalues
- array- Returns:
- index of pivot element
-
partitionSubList
public static int partitionSubList(int i, int j, char[] values) Partition a subarray ofvalues
. The element at indexj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.- Parameters:
i
- index of first element of subarrayj
- index of last element of subarrayvalues
- array- Returns:
- index of pivot element
-
partitionSubList
Partition a sublist ofvalues
. The element at indexj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.- Parameters:
i
- index of first element of the sublistj
- index of last element of the sublistvalues
- the listcompare
- ordering function on T- Returns:
- index of pivot element
-
partitionSubList
Partition a sublist ofvalues
. The element at indexj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.- Parameters:
i
- index of first element of the sublistj
- index of last element of the sublistvalues
- the list- Returns:
- index of pivot element
-
partitionSubList
public static <T> void partitionSubList(ListIterator<T> i, ListIterator<T> j, Comparator<? super T> compare) Partition a sublist. The element atj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.After the function returns, the iterator
i
is on the pivot element. That is,i.next()
gives the element after the pivot.- Parameters:
i
- iterator pointing before first element of the sublist, that is,i.next()
gives you the first element.j
- iterator pointing behind the last element of the sublist, that is,i.previous()
gives you the last element.compare
- ordering function on T
-
partitionSubList
Partition a sublist. The element atj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller, and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.After the function returns, the iterator
i
is on the pivot element. That is,i.next()
gives the element after the pivot.- Parameters:
i
- iterator pointing before first element of the sublist, that is,i.next()
gives you the first element.j
- iterator pointing behind the last element of the sublist, that is,i.previous()
gives you the last element.
-
partitionSubList
public static <T> int partitionSubList(int i, int j, List<T> values, int[] permutation, Comparator<? super T> compare) Partition a sublist ofvalues
. The element at indexj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.The
permutation
array is permuted in the same way as the list. Usually, this will be an array of indices, so that the partition operation can be mirrored in another list: Suppose, we have a list of keys and a lists (or several) of values. If we usepartitionSubList
to sort the keys, we want to reorder the values in the same manner. We pass an indices array [0, 1, 2, ...] and use the permutation of the indices to permute the values list.- Parameters:
i
- index of first element of the sublistj
- index of last element of the sublistvalues
- the listpermutation
- elements of this array are permuted in the same way as the elements in the values listcompare
- ordering function on T- Returns:
- index of pivot element
-
partitionSubList
public static <T extends Comparable<T>> int partitionSubList(int i, int j, List<T> values, int[] permutation) Partition a sublist ofvalues
. The element at indexj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.The
permutation
array is permuted in the same way as the list. Usually, this will be an array of indices, so that the partition operation can be mirrored in another list: Suppose, we have a list of keys and a lists (or several) of values. If we usepartitionSubList
to sort the keys, we want to reorder the values in the same manner. We pass an indices array [0, 1, 2, ...] and use the permutation of the indices to permute the values list.- Parameters:
i
- index of first element of the sublistj
- index of last element of the sublistvalues
- the listpermutation
- elements of this array are permuted in the same way as the elements in the values list- Returns:
- index of pivot element
-
partitionSubList
public static <T> void partitionSubList(ListIterator<T> i, ListIterator<T> j, int[] permutation, Comparator<? super T> compare) Partition a sublist. The element atj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.After the function returns, the iterator
i
is on the pivot element. That is,i.next()
gives the element after the pivot.The
permutation
array is permuted in the same way as the list. Usually, this will be an array of indices, so that the partition operation can be mirrored in another list: Suppose, we have a list of keys and a lists (or several) of values. If we usepartitionSubList
to sort the keys, we want to reorder the values in the same manner. We pass an indices array [0, 1, 2, ...] and use the permutation of the indices to permute the values list.- Parameters:
i
- iterator pointing before first element of the sublist, that is,i.next()
gives you the first element.j
- iterator pointing behind the last element of the sublist, that is,i.previous()
gives you the last element.permutation
- elements of this array are permuted in the same way as the elements in the values listcompare
- ordering function on T
-
partitionSubList
public static <T extends Comparable<T>> void partitionSubList(ListIterator<T> i, ListIterator<T> j, int[] permutation) Partition a sublist. The element atj
is taken as the pivot value. The elements[i,j]
are reordered, such that all elements before the pivot are smaller, and all elements after the pivot are equal or larger than the pivot. The index of the pivot element is returned.After the function returns, the iterator
i
is on the pivot element. That is,i.next()
gives the element after the pivot.- Parameters:
i
- iterator pointing before first element of the sublist, that is,i.next()
gives you the first element.j
- iterator pointing behind the last element of the sublist, that is,i.previous()
gives you the last element.permutation
- elements of this array are permuted in the same way as the elements in the values list
-