public class BufferSort extends Object
| Constructor and Description |
|---|
BufferSort() |
| Modifier and Type | Method and Description |
|---|---|
static void |
countingSort(ByteBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
ByteBuffer in ascending order (lowest
first). |
static void |
countingSort(ShortBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
ShortBuffer in ascending order (lowest
first). |
static void |
heapSort(ByteBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
ByteBuffer in ascending order (lowest
first). |
static void |
heapSort(DoubleBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
DoubleBuffer in ascending order
(lowest first). |
static void |
heapSort(FloatBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
FloatBuffer in ascending order (lowest
first). |
static void |
heapSort(IntBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
IntBuffer in ascending order (lowest
first). |
static void |
heapSort(LongBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
LongBuffer in ascending order (lowest
first). |
static void |
heapSort(ShortBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
ShortBuffer in ascending order (lowest
first). |
static void |
insertionSort(ByteBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
ByteBuffer in ascending order (lowest
first). |
static void |
insertionSort(DoubleBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
DoubleBuffer in ascending order
(lowest first). |
static void |
insertionSort(FloatBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
FloatBuffer in ascending order (lowest
first). |
static void |
insertionSort(IntBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
IntBuffer in ascending order (lowest
first). |
static void |
insertionSort(LongBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
LongBuffer in ascending order (lowest
first). |
static void |
insertionSort(ShortBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
ShortBuffer in ascending order (lowest
first). |
static void |
radixSort(IntBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
IntBuffer in ascending order (lowest
first). |
static void |
radixSort(LongBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
LongBuffer in ascending order (lowest
first). |
static void |
sort(ByteBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
ByteBuffer in ascending order (lowest
first). |
static void |
sort(DoubleBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
DoubleBuffer in ascending order
(lowest first). |
static void |
sort(FloatBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
FloatBuffer in ascending order (lowest
first). |
static void |
sort(IntBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
IntBuffer in ascending order (lowest
first). |
static void |
sort(LongBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
LongBuffer in ascending order (lowest
first). |
static void |
sort(ShortBuffer b,
int fromIndex,
int toIndex)
Sorts a range of the specified
ShortBuffer in ascending order (lowest
first). |
public static void heapSort(IntBuffer b, int fromIndex, int toIndex)
IntBuffer in ascending order (lowest
first). The sort is:
O(n*log(n)) in the worst case
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void heapSort(LongBuffer b, int fromIndex, int toIndex)
LongBuffer in ascending order (lowest
first). The sort is:
O(n*log(n)) in the worst case
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void heapSort(ShortBuffer b, int fromIndex, int toIndex)
ShortBuffer in ascending order (lowest
first). The sort is:
O(n*log(n)) in the worst case
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void heapSort(ByteBuffer b, int fromIndex, int toIndex)
ByteBuffer in ascending order (lowest
first). The sort is:
O(n*log(n)) in the worst case
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void heapSort(FloatBuffer b, int fromIndex, int toIndex)
FloatBuffer in ascending order (lowest
first). The sort is:
O(n*log(n)) in the worst case
Float.POSITIVE_INFINITY).b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void heapSort(DoubleBuffer b, int fromIndex, int toIndex)
DoubleBuffer in ascending order
(lowest first). The sort is:
O(n*log(n)) in the worst case
Double.POSITIVE_INFINITY).b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void radixSort(IntBuffer b, int fromIndex, int toIndex)
IntBuffer in ascending order (lowest
first). The sort is:
O(n) in the worst case. However, insertion sort has more overhead
than heat sort, and is only faster for large ranges.
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void radixSort(LongBuffer b, int fromIndex, int toIndex)
LongBuffer in ascending order (lowest
first). The sort is:
O(n) in the worst case. However, insertion sort has more overhead
than heat sort, and is only faster for large ranges.
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void countingSort(ShortBuffer b, int fromIndex, int toIndex)
ShortBuffer in ascending order (lowest
first). This sort is O(n) in the worst case, but it creates and
iterates over an int array of length 2^16.b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void countingSort(ByteBuffer b, int fromIndex, int toIndex)
ByteBuffer in ascending order (lowest
first). This sort is O(n) in the worst case, but it creates and
iterates over an int array of length 2^8.b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void insertionSort(IntBuffer b, int fromIndex, int toIndex)
IntBuffer in ascending order (lowest
first). The sort is:
O(n^2) in the worst case. However, insertion sort has less
overhead than heat sort, and is faster for small ranges.
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void insertionSort(LongBuffer b, int fromIndex, int toIndex)
LongBuffer in ascending order (lowest
first). The sort is:
O(n^2) in the worst case. However, insertion sort has less
overhead than heat sort, and is faster for small ranges.
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void insertionSort(ShortBuffer b, int fromIndex, int toIndex)
ShortBuffer in ascending order (lowest
first). The sort is:
O(n^2) in the worst case. However, insertion sort has less
overhead than heat sort, and is faster for small ranges.
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void insertionSort(ByteBuffer b, int fromIndex, int toIndex)
ByteBuffer in ascending order (lowest
first). The sort is:
O(n^2) in the worst case. However, insertion sort has less
overhead than heat sort, and is faster for small ranges.
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void insertionSort(FloatBuffer b, int fromIndex, int toIndex)
FloatBuffer in ascending order (lowest
first). The sort is:
O(n^2) in the worst case. However, insertion sort has less
overhead than heat sort, and is faster for small ranges.
Float.POSITIVE_INFINITY).b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void insertionSort(DoubleBuffer b, int fromIndex, int toIndex)
DoubleBuffer in ascending order
(lowest first). The sort is:
O(n^2) in the worst case. However, insertion sort has less
overhead than heat sort, and is faster for small ranges.
Double.POSITIVE_INFINITY).b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void sort(IntBuffer b, int fromIndex, int toIndex)
IntBuffer in ascending order (lowest
first). The actual sorting algorithm used depends on the length of the range:
| Length | Algorithm |
|---|---|
[0 - 100) |
insertionSort |
[100 - 10^7) |
heapSort |
10^7+ |
radixSort |
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void sort(LongBuffer b, int fromIndex, int toIndex)
LongBuffer in ascending order (lowest
first). The actual sorting algorithm used depends on the length of the range:
| Length | Algorithm |
|---|---|
[0 - 100) |
insertionSort |
[100 - 10^7) |
heapSort |
10^7+ |
radixSort |
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void sort(ShortBuffer b, int fromIndex, int toIndex)
ShortBuffer in ascending order (lowest
first). The actual sorting algorithm used depends on the length of the range:
| Length | Algorithm |
|---|---|
[0 - 100) |
insertionSort |
[100 - 10^7) |
heapSort |
10^7+ |
countingSort |
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void sort(ByteBuffer b, int fromIndex, int toIndex)
ByteBuffer in ascending order (lowest
first). The actual sorting algorithm used depends on the length of the range:
| Length | Algorithm |
|---|---|
[0 - 100) |
insertionSort |
[100 - 10^5) |
heapSort |
10^5+ |
countingSort |
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void sort(FloatBuffer b, int fromIndex, int toIndex)
FloatBuffer in ascending order (lowest
first). The actual sorting algorithm used depends on the length of the range:
| Length | Algorithm |
|---|---|
[0 - 100) |
insertionSort |
100+ |
heapSort |
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()public static void sort(DoubleBuffer b, int fromIndex, int toIndex)
DoubleBuffer in ascending order
(lowest first). The actual sorting algorithm used depends on the length of
the range:
| Length | Algorithm |
|---|---|
[0 - 100) |
insertionSort |
100+ |
heapSort |
b - the buffer to be sortedfromIndex - the index of the first element (inclusive) to be sortedtoIndex - the index of the last element (exclusive) to be sortedIllegalArgumentException - if fromIndex > toIndexIndexOutOfBoundsException - if
fromIndex < 0 or toIndex > b.capacity()Copyright © 2020. All rights reserved.