public class IntBigArrays extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
displacement(long index)
Computes the displacement associated with a given index.
|
static int |
get(int[][] array,
long index)
Returns the element of the given big array of specified index.
|
static void |
quickSort(int[][] x,
long from,
long to,
IntComparator comp)
Sorts the specified range of elements according to the order induced by the specified
comparator using quicksort.
|
static int |
segment(long index)
Computes the segment associated with a given index.
|
static void |
set(int[][] array,
long index,
int value)
Sets the element of the given big array of specified index.
|
static void |
swap(int[][] array,
long first,
long second)
Swaps the element of the given big array of specified indices.
|
public static int segment(long index)
index - an index into a big array.public static int displacement(long index)
index - an index into a big array.public static int get(int[][] array,
long index)
array - a big array.index - a position in the big array.public static void set(int[][] array,
long index,
int value)
array - a big array.index - a position in the big array.public static void swap(int[][] array,
long first,
long second)
array - a big array.first - a position in the big array.second - a position in the big array.public static void quickSort(int[][] x,
long from,
long to,
IntComparator comp)
The sorting algorithm is a tuned quicksort adapted from Jon L. Bentley and M. Douglas McIlroy, “Engineering a Sort Function”, Software: Practice and Experience, 23(11), pages 1249−1265, 1993.
x - the big array to be sorted.from - the index of the first element (inclusive) to be sorted.to - the index of the last element (exclusive) to be sorted.comp - the comparator to determine the sorting order.Copyright © 2012–2022. All rights reserved.