Skip to content
Snippets Groups Projects
Commit 80c6726f authored by Lars Bilke's avatar Lars Bilke
Browse files

Fixed function ordering.

parent 2910b033
No related branches found
No related tags found
No related merge requests found
......@@ -14,16 +14,6 @@
// Base
#include "swap.h"
template <class T>
void quickSort(T* array, unsigned beg, unsigned end)
{
if (beg < end) {
unsigned p = partition_(array, beg, end);
quickSort(array, beg, p);
quickSort(array, p+1, end);
}
}
template <class T>
unsigned partition_(T* array, unsigned beg, unsigned end)
{
......@@ -43,6 +33,16 @@ unsigned partition_(T* array, unsigned beg, unsigned end)
return j;
}
template <class T>
void quickSort(T* array, unsigned beg, unsigned end)
{
if (beg < end) {
unsigned p = partition_(array, beg, end);
quickSort(array, beg, p);
quickSort(array, p+1, end);
}
}
/**
* Permutes the entries of a part of an array such that all entries that are smaller
* than a certain value are at the beginning of the array and all entries that are
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment