Sorting Functions

Functions

LIBEXPORT void heapsort (void *array, INT32 n, INT32 size, int(*compare)(void *a, void *b, void *hookdata), void *hookdata)
LIBEXPORT int HeapSortGen (INT32 n, int(*compare)(INT32 a, INT32 b, void *hookdata), int(*swap)(INT32 a, INT32 b, void *hookdata), void *hookdata)

Function Documentation

LIBEXPORT void heapsort ( void *  array,
INT32  n,
INT32  size,
int(*)(void *a, void *b, void *hookdata)  compare,
void *  hookdata 
)

Memory based heapsort.

Sorts an array in memory. Assumes it can use memcpy() to swap items.

Parameters:
array Array to sort
n Number of elements in array
size sizeof() each element
hookdata Compare function. Return 1 if *a <= *b. Passed as 3rd parameter to compare function
LIBEXPORT int HeapSortGen ( INT32  n,
int(*)(INT32 a, INT32 b, void *hookdata)  compare,
int(*)(INT32 a, INT32 b, void *hookdata)  swap,
void *  hookdata 
)

Generic Heapsort.

Parameters:
n Number of items to sort
swap Return 1 if item a <= item b
hookdata Swap two items Passed as 3rd parameter to compare and swap functions

Generated on Sun Oct 7 21:33:04 2012 for TNTsdk 2012 by  doxygen 1.6.1