Mod 5 all sorts

This commit is contained in:
jugal 2025-03-08 22:26:57 +05:30
parent f12dd3574e
commit 9e9d30accf

View File

@ -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) {