#include
#include
//
// Quick Sort adapted from Wikipedia: http://en.wikipedia.org/wiki/Quicksort
// cmp (a,b) == -1 if ab
//
int partition (void* array[], int left, int right, int pivotIndex, int (*cmp) (void*, void*)) {
void *pivotValue, *t;
int storeIndex;
pivotValue = array [pivotIndex];
array [pivotIndex] = array [right];
array [right] = pivotValue;
storeIndex = left;
for (int i=left; i