Reusable Java library of general tools with minimal external dependencies.
For questions or support, please contact us:
Email: support@aoindustries.com
Phone: 1-800-519-9541
Phone: +1-251-607-9556
Web: https://www.aoindustries.com/contact
public final class ShellSort extends Object
http://www.auto.tuwien.ac.at/~blieb/woop/shell.html Shellsort is a simple extension of insertion sort which gains speed by allowing exchanges of elements that are far apart. The idea is to rearrange the array to give it the property that every hth element (starting anywhere) yields a sorted array. Such an array is said to be h-sorted. By h-sorting for some large values of h, we can move elements in the array long distances and thus make it easier to h-sort for smaller values of h. Using such a procedure for any sequence of values h which ends in 1 will produce a sorted array.
Adapted from Jason Harrison's ShellSortAlgorithm.
| Modifier and Type | Method and Description |
|---|---|
protected static <T> int |
compare(List<T> list,
int i,
int j,
Comparator<? super T> comparator,
SortStatistics stats) |
protected static <T> int |
compare(T[] array,
int i,
int j,
Comparator<? super T> comparator,
SortStatistics stats) |
protected static <T> int |
compare(T O1,
T O2,
Comparator<? super T> comparator,
SortStatistics stats) |
protected static <T> T |
get(List<T> list,
int i,
SortStatistics stats) |
protected static <T> T |
get(T[] array,
int i,
SortStatistics stats) |
static ShellSort |
getInstance() |
boolean |
isStable()
Checks if this is a stable sort.
|
protected static <T> void |
set(List<T> list,
int i,
T O,
SortStatistics stats) |
protected static <T> void |
set(T[] array,
int i,
T O,
SortStatistics stats) |
<T extends E> |
sort(List<T> list) |
<T extends E> |
sort(List<T> list,
Comparator<? super T> comparator) |
<T> void |
sort(List<T> list,
Comparator<? super T> comparator,
SortStatistics stats) |
<T extends E> |
sort(List<T> list,
SortStatistics stats) |
<T extends E> |
sort(T[] array) |
<T extends E> |
sort(T[] array,
Comparator<? super T> comparator) |
<T> void |
sort(T[] array,
Comparator<? super T> comparator,
SortStatistics stats) |
<T extends E> |
sort(T[] array,
SortStatistics stats) |
protected static <T> void |
swap(List<T> list,
int i,
int j,
SortStatistics stats) |
protected static <T> void |
swap(T[] array,
int i,
int j,
SortStatistics stats) |
public static ShellSort getInstance()
public boolean isStable()
SortAlgorithmpublic <T> void sort(List<T> list, Comparator<? super T> comparator, SortStatistics stats)
sort in interface ComparisonSortAlgorithm<Object>public <T> void sort(T[] array,
Comparator<? super T> comparator,
SortStatistics stats)
sort in interface ComparisonSortAlgorithm<Object>public <T extends E> void sort(List<T> list)
sort in interface SortAlgorithm<E>public <T extends E> void sort(T[] array)
sort in interface SortAlgorithm<E>public <T extends E> void sort(List<T> list, SortStatistics stats)
sort in interface SortAlgorithm<E>public <T extends E> void sort(T[] array,
SortStatistics stats)
sort in interface SortAlgorithm<E>public <T extends E> void sort(List<T> list, Comparator<? super T> comparator)
sort in interface ComparisonSortAlgorithm<E>public <T extends E> void sort(T[] array,
Comparator<? super T> comparator)
sort in interface ComparisonSortAlgorithm<E>protected static <T> int compare(List<T> list, int i, int j, Comparator<? super T> comparator, SortStatistics stats)
protected static <T> int compare(T[] array,
int i,
int j,
Comparator<? super T> comparator,
SortStatistics stats)
protected static <T> int compare(T O1,
T O2,
Comparator<? super T> comparator,
SortStatistics stats)
protected static <T> T get(List<T> list, int i, SortStatistics stats)
protected static <T> T get(T[] array,
int i,
SortStatistics stats)
protected static <T> void set(List<T> list, int i, T O, SortStatistics stats)
protected static <T> void set(T[] array,
int i,
T O,
SortStatistics stats)
protected static <T> void swap(List<T> list, int i, int j, SortStatistics stats)
protected static <T> void swap(T[] array,
int i,
int j,
SortStatistics stats)
Copyright © 2000–2016 AO Industries, Inc.. All rights reserved.