Sorting algorithms (Java)

School project
02 October 2006

Oblig 3:

For this hand in you have to create the three sorting algorithms; Insertionsort, Shellsort and Quicksort.

The program should be able to read a given number of people from a file, and then put this information into a lot of different person objects. These objects will then be placed in a vector or array list. You will then need to sort the person objects after last name, from A-. If a person with a similar last name occur, the first name should be used. When the sorting is completed the person objects needs to be written to a new file in the sorted order.

When you start up the program the first task that should pop up is how many persons the user wants to read in. The user should then be able to choose what kind of sorting algorithm he would like to use on the given person stack.

The user should have the possibility to do a new sorting as many times as he wants to, before he decides to exit the program. The name of the file that's written out should have this format: PersonSortXX.dta, where XX stands for how many persons that's sorted.

During the sorting algorithms you have to count the number of comparisons that's being done, and also the number of switches. (Everything in real time) The runtime should be measured from the system clock before and after a sorting is completed. The marginal between these times should then be your runtime. When the sorting is done the result should be written out on the screen:
Total elements sorted, total comparisons, total switches and the total runtime.

Grade given: B

You have to be logged in to download the project files!
If you are interested in the project files then contact me