42 void quicksort(
const Treal* value,
int* index,
int low,
int high)
49 Treal pivot = value[index[(low + high) / 2]];
51 while (value[index[i]] < pivot) i++;
52 while (value[index[j]] > pivot) j--;
61 if(low < j)
quicksort(value, index, low, j);
62 if(i < high)
quicksort(value, index, i, high);
69 template<
typename Treal,
typename Tfun>
70 void quicksort(Tfun
const & fun,
int* index,
int low,
int high)
71 throw(std::exception){
75 Treal pivot = fun.value(index[(low + high) / 2]);
77 while (fun.value(index[i]) < pivot) i++;
78 while (fun.value(index[j]) > pivot) j--;
88 if(low < j) quicksort<Treal>(fun, index, low, j);
89 if(i < high) quicksort<Treal>(fun, index, i, high);
93 void quicksort(
const Treal* value,
int* index,
int low,
int high) {
97 Treal pivot = value[index[(low + high) / 2]];
99 while (value[index[i]] < pivot) i++;
100 while (value[index[j]] > pivot) j--;
109 if(low < j)
quicksort(value, index, low, j);
110 if(i < high)
quicksort(value, index, i, high);
void quicksort(const Treal *value, int *index, int low, int high)
Definition: sort.h:42
Definition: allocate.cc:39