Objective
practice sorting algorithms
Overview
Student.txt in the attachment below contains the roster of a class. Each student object has the following fields:
student id, last name, first name, academic level.
Create a RosterClass to store the student database in vector.
RosterClass has an "insertionSort" function that sorts students by student id.
RosterClass has another "quickSort" function that sorts students by first name.
Note: since we can not overloading operator < for two different keys, we can use another operator to indicate "less". Alternatively, use the functions is also fine.
Note
I would examine or print out the pivot and the intermediate results after each sort invocation.
If you're not comfortable with CSV (comma separated value) file parsing for input, you can edit the student.txt file to make it cin >> friendly.
Discussions
By changing student database to linked list, then it will become a good exercise for mergeSort.
By changing student database to an array, then it will become a good exercise for heapSort. HeapSort programming definitely involves BuildingHeap from array and Heapify algorithms.
All I am trying to say is that the practice opportunities are there. You decide how far you want to go.