Admin Production ni-theme
Current Publication

ListHeapSort

LabWindows/CVI

ListHeapSort

void ListHeapSort (ListType listToSort, CompareFunction compareFunction);

Purpose

This function sorts the list using the HeapSort function.

ListHeapSort, like ListQuickSort, is a n*log n algorithm. However for almost all inputs, ListQuickSort will run 2–3 times faster, making it a better choice.

See the help for the HeapSort function panel.

Parameters

Input
Name Type Description
listToSort ListType The list to be sorted in ascending order
compareFunction CompareFunction A comparison function that will be used to compare the items in the list.

The compare function should have the following prototype:

int CVICALLBACK CompareFunction(void *item1, void *item2);


The compare function should return a negative number if item1 is less than item2, it should return 0 if item1 is equal to item2, and it should return a positive number is item1 is greater than item2.

If zero (0) is passed for the compare function, the C Library function memcmp will be called to compare items.

This instrument driver provides several commonly useful comparison functions:

ShortCompare
IntCompare
FloatCompare
DoubleCompare
CStringCompare
CStringNoCaseCompare

Return Value

None.

Additional Information

Library: Programmer's Toolbox

Include file: toolbox\toolbox.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later