Exemple #1
0
// main entry of quick sort routine
void randomized_quicksort(Aux A[], int p, int r) {
    if (p < r) {
        int q = randomized_partition(A, p, r);
        randomized_quicksort(A, p, q-1);
        randomized_quicksort(A, q+1, r);
    }
}
void K_Merge::randomized_quicksort(_array_struct& arr, int start, int end) {
  if (start < end) {
    int q = randomized_partition(arr, start, end);
    randomized_quicksort(arr, start, q-1);
    randomized_quicksort(arr,q+1, end);
  }
}
Exemple #3
0
void randomized_quicksort(int *arr, int start, int end)
{
	if(start >= end)
		return;
	int middle = randomized_partition(arr, start, end);
	randomized_quicksort(arr, start, middle-1);
	randomized_quicksort(arr, middle+1, end);
}
void randomized_quicksort(Array &A, int p, int r){

  if (p<r){ // se l'indice p e' minore dell'indice r

  int q = randomized_partition(A, p, r);

  randomized_quicksort(A,p,q-1); // chiamo la rand_quick su i due sottovettori
  randomized_quicksort(A,q+1,r);
            }
  }
void K_Merge::do_randomized_quicksort() {
  for (int i=0; i<_size; ++i) {
    int j = _array[i]._array_size - 1;
    randomized_quicksort(_array[i], 0, j);
  }
}