Skip to content

Instantly share code, notes, and snippets.

@senoritadeveloper01
Created January 19, 2022 20:33
Show Gist options
  • Save senoritadeveloper01/84889c3a4d1d679be49d0c069cb396b1 to your computer and use it in GitHub Desktop.
Save senoritadeveloper01/84889c3a4d1d679be49d0c069cb396b1 to your computer and use it in GitHub Desktop.
Shell Sort Implementation in Java
public static void shellSort(int arr[]) {
for (int i = arr.length / 2; i > 0; i /= 2) {
for (int j = i; j < arr.length; j += 1) {
int value = array[j];
int k;
for (k = j; k >= i && array[k - i] > temp; k -= i) {
array[k] = array[k - i];
}
array[k] = value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment