Sort

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

Methods

static int[] BubbleSort(int[] arr)

In-place bubble sort swapping elements in adjacent order.

static int[] CocktailShakerSort(int[] arr)

Bidirectional bubble sort variant.

static int[] OddEvenSort(int[] arr)

Parallel-friendly comparison sort alternating odd/even index passes.

static int[] QuickSort(int[] arr)

Divide-and-conquer quicksort using pivot partitioning.

static int[] MergeSort(int[] arr)

Stable divide-and-conquer merge sort.

static int[] HeapSort(int[] arr)

PriorityQueue-backed binary heap sort.

static int[] IntroSort(int[] arr)

Hybrid sort switching from QuickSort to HeapSort based on recursion depth.

static int[] TimSort(int[] arr)

Hybrid stable sort derived from MergeSort and InsertionSort.

static double[] BucketSortUniform(double[] arr)

Distribution sort for uniformly distributed floating-point numbers in [0.0, 1.0).

static int[] TreeSort(int[] arr)

Binary Search Tree insertion and in-order traversal sort.

static int[] PatienceSorting(int[] arr)

Piles-based sorting utilizing PriorityQueue dequeues.

static int[] BeadSort(int[] arr)

Gravity/bead sort for positive integers.