This program involves using STL lists.
For this program you will implement three functions whose prototypes are given below:
list::iterator mxIter(list::iterator first,
list::iterator last);
void selectSort(list& aList);
void writeList(const list& alist);
What you need to do:
You are going to use a static array declared using { 12, 1, 6, 8, 5, 9, 22, 9, 13, 17 } to initialize an STL list, as shown in the slides.
Then you will implement a selection sort (selectSort). A selection sort involves sweeping over the list and finding the maximum element of the list (by calling MxIter) that has not already been sorted, creating a new element at the beginning of the list, setting its value to be the same as the maximum element's value, and then deleting the maximum element (using erase).
Unsorted list: 12 1 6 8 5 9 22 9 13 17
Sorted list: 1 5 6 8 9 9 12 13 17 22