#include <list.h>
Static Public Member Functions | |
static void | Sort (ListItem &list, int itemcount, param_t parameter) |
Invokes the MergeSort algorithm. | |
static void | Sort (ListItem &list, param_t parameter) |
Alternative overload of Sort() which determines length. |
Templated class with a single static function Sort(), used for sorting lists of any type of object, using the MergeSort algorithm. This is useful for sorting objects for which direct comparison is possible but no numeric value can easily be associated with each. Note the restrictions below. This well-known algorithm exhibits O(N * log2(N)) performance for sorting a list of N objects, guaranteed in all cases.
CompFunc | Comparison function container-class. |
static void Sort | ( | ListItem & | list, | |
int | itemcount, | |||
param_t | parameter | |||
) | [inline, static] |
Invokes the MergeSort algorithm.
Sorts a list of ListItems. Operates recursively and can create a large call stack for long lists of objects to be sorted.
MergeSort must divide the list of items into two, so the length of the list must be known.
list | List of items. | |
itemcount | Number of items in list. | |
parameter | Argument to the comparison function. |
static void Sort | ( | ListItem & | list, | |
param_t | parameter | |||
) | [inline, static] |