javatpoint shell sort code example
Example: javatpoint shell sort
public static void sort(int arr[], int n){
int gap = n/2+1;
while(gap >= 1){
int i = 0;
int j = gap;
while(i < n-gap && j < n){
if(arr[i] > arr[j]){
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
i++;
j++;
}
gap = gap/2;
}