35 void quicksort(
const Treal* value,
int* index,
int low,
int high)
36 throw(std::exception){
42 Treal pivot = value[index[(low + high) / 2]];
44 while (value[index[i]] < pivot) i++;
45 while (value[index[j]] > pivot) j--;
54 if(low < j)
quicksort(value, index, low, j);
55 if(i < high)
quicksort(value, index, i, high);
62 template<
typename Treal,
typename Tfun>
63 void quicksort(Tfun
const & fun,
int* index,
int low,
int high)
64 throw(std::exception){
68 Treal pivot = fun.value(index[(low + high) / 2]);
70 while (fun.value(index[i]) < pivot) i++;
71 while (fun.value(index[j]) > pivot) j--;
81 if(low < j) quicksort<Treal>(fun, index, low, j);
82 if(i < high) quicksort<Treal>(fun, index, i, high);
86 void quicksort(
const Treal* value,
int* index,
int low,
int high) {
90 Treal pivot = value[index[(low + high) / 2]];
92 while (value[index[i]] < pivot) i++;
93 while (value[index[j]] > pivot) j--;
102 if(low < j)
quicksort(value, index, low, j);
103 if(i < high)
quicksort(value, index, i, high);