shellSort

void shellSort(int arr[], int n){
  int gap, i, j;

  for(gap = n/2; gap > 0; gap /=2)
    for(i = gap; i < n; i++)
      for(j = i - gap; j >= 0 && v[j] >v[j +gap]; j-=gap)
        swap(v[j], v[j + gap]);
}

results matching ""

    No results matching ""