quicksort

This commit is contained in:
Joachim Schoeberl 2009-10-28 00:22:10 +00:00
parent 94a06d8cae
commit 20c2f2757e
3 changed files with 55 additions and 55 deletions

View File

@ -612,8 +612,8 @@ namespace netgen
template <class T, class S>
void QickSortRec (FlatArray<T> & data,
FlatArray<T> & slave,
void QuickSortRec (FlatArray<T> & data,
FlatArray<S> & slave,
int left, int right)
{
int i = left;
@ -633,14 +633,14 @@ namespace netgen
}
}
while (i <= j);
if (left < j) QickSortRec (data, slave, left, j);
if (i < right) QickSortRec (data, slave, i, right);
if (left < j) QuickSortRec (data, slave, left, j);
if (i < right) QuickSortRec (data, slave, i, right);
}
template <class T, class S>
void QickSort (FlatArray<T> & data, FlatArray<S> & slave)
void QuickSort (FlatArray<T> & data, FlatArray<S> & slave)
{
QickSortRec (data, slave, 0, data.Size()-1);
QuickSortRec (data, slave, 0, data.Size()-1);
}

View File

@ -35,7 +35,7 @@ void Sort (const Array<double> & values,
}
void QickSortRec (const Array<double> & values,
void QuickSortRec (const Array<double> & values,
Array<int> & order,
int left, int right)
{
@ -58,11 +58,11 @@ void QickSortRec (const Array<double> & values,
}
}
while (i <= j);
if (left < j) QickSortRec (values, order, left, j);
if (i < right) QickSortRec (values, order, i, right);
if (left < j) QuickSortRec (values, order, left, j);
if (i < right) QuickSortRec (values, order, i, right);
}
void QickSort (const Array<double> & values,
void QuickSort (const Array<double> & values,
Array<int> & order)
{
int i, n = values.Size();
@ -70,6 +70,6 @@ void QickSort (const Array<double> & values,
for (i = 1; i <= n; i++)
order.Elem(i) = i;
QickSortRec (values, order, 1, order.Size());
QuickSortRec (values, order, 1, order.Size());
}
}

View File

@ -14,7 +14,7 @@ namespace netgen
extern void Sort (const Array<double> & values,
Array<int> & order);
extern void QickSort (const Array<double> & values,
extern void QuickSort (const Array<double> & values,
Array<int> & order);