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
|
||||
public void sort(E[] arr) {
|
||||
Insertion<E> sortingAlgorithm = new Insertion<>();
|
||||
sortingAlgorithm.sort(arr, 7);
|
||||
sortingAlgorithm.sort(arr, 3);
|
||||
sortingAlgorithm.sort(arr);
|
||||
|
||||
int h=1, N=arr.length;
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user