|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.amino.alg.sort.AbstractSorter
org.amino.alg.sort.DefaultSorter
org.amino.alg.sort.InsertionSorter
public class InsertionSorter
This class implements the basic Insertion sorting algorithm. Insertion sort is a simple comparison sorting algorithm that can be used for small lists of data. It is efficient for small sets of data. For larger lists more efficient algorithms like quicksort, heapsort etc. should be used.
Constructor Summary | |
---|---|
InsertionSorter()
|
Method Summary | |
---|---|
void |
reverse(byte[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
void |
reverse(char[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
void |
reverse(double[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
void |
reverse(float[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
void |
reverse(int[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
void |
reverse(long[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
void |
reverse(short[] a,
int from,
int to)
Sort array using reverse natural (descending) order. |
void |
sort(byte[] a,
int from,
int to)
|
void |
sort(char[] a,
int from,
int to)
|
void |
sort(double[] a,
int from,
int to)
|
void |
sort(float[] a,
int from,
int to)
|
void |
sort(int[] a,
int from,
int to)
|
void |
sort(long[] a,
int from,
int to)
|
void |
sort(short[] a,
int from,
int to)
|
Methods inherited from class org.amino.alg.sort.DefaultSorter |
---|
reverse, reverse, sort, sort, sort, sort, sort, sort, sortp |
Methods inherited from class org.amino.alg.sort.AbstractSorter |
---|
reverse, reverse, reverse, reverse, reverse, reverse, reverse, reverse, reverse, sort, sort, sort, sort, sort, sort, sort, sort, sort, swap, swap, swap, swap, swap, swap, swap, swap, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfGreater, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess, swapIfLess |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InsertionSorter()
Method Detail |
---|
public void sort(byte[] a, int from, int to)
sort
in interface Sorter
sort
in class DefaultSorter
a
- is the byte array to be sorted in an ascending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(byte[], int, int)
public void reverse(byte[] a, int from, int to)
Sorter
reverse
in interface Sorter
reverse
in class DefaultSorter
a
- is the byte array to be sorted in a descending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void sort(char[] a, int from, int to)
sort
in interface Sorter
sort
in class DefaultSorter
a
- is the character array to be sorted in an ascending order
using Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(byte[], int, int)
public void reverse(char[] a, int from, int to)
Sorter
reverse
in interface Sorter
reverse
in class DefaultSorter
a
- is the character array to be sorted in a descending order
using Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void sort(short[] a, int from, int to)
sort
in interface Sorter
sort
in class DefaultSorter
a
- is the short array to be sorted in an ascending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(short[], int, int)
public void reverse(short[] a, int from, int to)
Sorter
reverse
in interface Sorter
reverse
in class DefaultSorter
a
- is the short array to be sorted in a descending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void sort(int[] a, int from, int to)
sort
in interface Sorter
sort
in class DefaultSorter
a
- is the int array to be sorted in an ascending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(short[], int, int)
public void reverse(int[] a, int from, int to)
Sorter
reverse
in interface Sorter
reverse
in class DefaultSorter
a
- is the int array to be sorted in a descending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void sort(long[] a, int from, int to)
sort
in interface Sorter
sort
in class DefaultSorter
a
- is the long array to be sorted in an ascending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(short[], int, int)
public void reverse(long[] a, int from, int to)
Sorter
reverse
in interface Sorter
reverse
in class DefaultSorter
a
- is the long array to be sorted in a descending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void sort(float[] a, int from, int to)
sort
in interface Sorter
sort
in class DefaultSorter
a
- is the float array to be sorted in an ascending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(short[], int, int)
public void reverse(float[] a, int from, int to)
Sorter
reverse
in interface Sorter
reverse
in class DefaultSorter
a
- is the float array to be sorted in a descending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedpublic void sort(double[] a, int from, int to)
sort
in interface Sorter
sort
in class DefaultSorter
a
- is the double array to be sorted in an ascending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sortedArrays.sort(short[], int, int)
public void reverse(double[] a, int from, int to)
Sorter
reverse
in interface Sorter
reverse
in class DefaultSorter
a
- is the double array to be sorted in a descending order using
Insertion Sort algorithmfrom
- is the start index of array to be sortedto
- is the end index of array to be sorted
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |