Here are a bunch of sort algorithms for LabVIEW. Included are:
- Bubblesort
- Heapsort
- Insertionsort
- Mergesort
- Quicksort
- Selectionsort
They work with classes so they are a 'bit' generic. So for example you have a array of a certain class called A. Then you have to implement a "less then" comparator. Do not forget that the < operator you will create must be a strict total order, http://en.wikipedia.org/wiki/Total_order#Strict_total_order, otherwise you may see strange behavoir. You will then pass the less operator to the sort function as strict VI reference.
Examples are included in the example folder.
Explanation on a strict total order relation. A relation is called strict total order, with relation the "less then" operator is meant, if the following holds
- Irreflexive, for all x in a certain domain it does not hold that x < x is true
- Transitive, for all x, y and z in a certain domain it follows that x < y and y < z implies x < z.
- Trichotomy, for all x and y in a certain domain it follows that only one of the following holds, x < y or y < x or x = y
- Strictly antisymmetric, for all x and y in a certain domain it does not hold both x < y and y < x are true.