public class ShellSort
extends java.lang.Object
The original implementation performs O(n2) comparisons and exchanges in the worst case. A minor change given in V. Pratt's book improved the bound to O(n log2 n). This is worse than the optimal comparison sorts, which are O(n log n).
For n < 50, roughly, Shell sort is competitive with the more complicated Quicksort on many machines. For n > 50, Quicksort is generally faster.
| Modifier and Type | Method and Description |
|---|---|
static void |
sort(double[] a)
Sorts the specified array into ascending numerical order.
|
static void |
sort(float[] a)
Sorts the specified array into ascending numerical order.
|
static void |
sort(int[] a)
Sorts the specified array into ascending numerical order.
|
static <T extends java.lang.Comparable<? super T>> |
sort(T[] a)
Sorts the specified array into ascending order.
|
public static void sort(int[] a)
public static void sort(float[] a)
public static void sort(double[] a)
public static <T extends java.lang.Comparable<? super T>> void sort(T[] a)