NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

stable sort

Hello,

In statement step type, for the function Sort, the third argument specify whether to run a stable sort or not. Does anybody know what does it mean ?

 

Thanks

0 Kudos
Message 1 of 2
(3,891 Views)

A stable sort is one that preserves the relative ordering of equivalent elements. If you want to sort, but keep things with equal values in their same relative position, then use stable sort. If you don't care about that then don't use stable sort.

 

For an array of basic types, stable sort isn't necessary since you wouldn't notice any difference anyway, but for an array of objects it might be important.

 

Stable sorting algorithms can be signficantly slower than non-stable ones (you probably would only notice for very large arrays though).

 

Hope this helps,

-Doug

0 Kudos
Message 2 of 2
(3,876 Views)