Sort

Utility class containing 18 high-performance sorting algorithm implementations optimized for int[] and double[] arrays.

Methods

static void bubbleSort(int[] arr)

In-place with early-exit swap optimization.

static void cocktailShakerSort(int[] arr)

Bidirectional sorting pass optimization.

static void selectionSort(int[] arr)

Selection passes that prevent self-swaps.

static void shellsort(int[] arr)

Shell sort utilizing Knuth's gap sequences.

static void quicksort(int[] arr)

Fast in-place sort using a copied array.

static void mergeSort(int[] arr)

Merge sort utilizing single-allocation helper arrays.

static void introsort(int[] arr)

Switches to Heap Sort when recursion depth limits are hit.

static void countingSort(int[] arr)

Features memory limits and non-negative checks.

static void bucketSortUniform(double[] arr)

Sorts elements within the [0.0, 1.0) range.

static void pigeonholeSort(int[] arr)

Fast sorting for dense value ranges.

static void treeSort(int[] arr)

Iterative BST traversal that prevents stack overflows.

static void patienceSorting(int[] arr)

Heap sorting optimization based on PileState.