Write selection sort in ML as discussed in class. Remember the
recursive specification for this algorithm:
- An empty list is already sorted
- For a non-empty list, the sorted list is the smallest element in the
list followed by a sorted version of the other elements in the list.
So all you have to do is figure out how to find a) the smallest element in the
list, and b) the list with that smallest element removed. You can
then sort (b), stick (a) on front of it, and voila!
Be sure you use good
ML style, including pattern matching and local variables as appropriate.
E-mail your selection sort code to me before class, and
bring hardcopy to class.