forked from Hithomelabs/Princeton1
Mod 5 all sorts
This commit is contained in:
parent
f12dd3574e
commit
9e9d30accf
@ -25,9 +25,16 @@ public class Shell<E> extends AbstractCustomSorts<E> {
|
|||||||
@Override
|
@Override
|
||||||
public void sort(E[] arr) {
|
public void sort(E[] arr) {
|
||||||
Insertion<E> sortingAlgorithm = new Insertion<>();
|
Insertion<E> sortingAlgorithm = new Insertion<>();
|
||||||
sortingAlgorithm.sort(arr, 7);
|
|
||||||
sortingAlgorithm.sort(arr, 3);
|
int h=1, N=arr.length;
|
||||||
sortingAlgorithm.sort(arr);
|
while(h < N/3)
|
||||||
|
h = 3*h + 1;
|
||||||
|
|
||||||
|
while( h >= 1){
|
||||||
|
sortingAlgorithm.sort(arr, h);
|
||||||
|
h=h/3;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int hsort(E[] arr, int h, MetaData metadata) {
|
private int hsort(E[] arr, int h, MetaData metadata) {
|
||||||
|
Loading…
Reference in New Issue
Block a user