The sort class has code for six sorting algorithms and has the following methods,
|Transfer data from the main program to the sort object
|Return data from the sort object to the main program
|Sort the data using a bubble sort
|Sort the data using an exchange sort
|Sort the data using an insertion sort
|Sort the data using a quick sort
|Sort the data using a Shell-Mietzner sort
|Sort the data using a tree sort
|a multi-field, indexed Shell sort
The main demonstrations allow the production of either a set of integer data or string data which can be sorted and timed by each of the methods.
The multi-field, Shell sort could be adapted for any of the other algorithms.
The multi-field demonstration generates an integer or string data set with up to ten fields which can be sorted on any selection of these ten, taken in any order by the MF_srt method.
There is also an option to sort names according to the UK English conventions and a data file, name.dta, to demonstrate this.
To allow for different types of data, the code is written using variant variables but could be re-dimensioned to fit specific data types so as to reduce memory usage and speed up the sorts.