Answers for "javatpoint shell sort"

0

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;
		}
Posted by: Guest on November-15-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language