Implement both the MergeSort
and QuickSort
algorithms. However,
instead of using Array
s, your implementation should work with Vector
s
instead.
For your implementation of QuickSort
, you must have two different ways of choosing
the pivot
element:
first
element as the pivot.
first
, last
and ((first + last)/2)
.
Your driver program should sort the following 3 Vector
s using both sort algorithms. In
the case of QuickSort
you should sort the Vector
with both methods of
selecting the pivot.
name
and phoneNumber
data items.
The name
items should be generated in aphabetical order. All your contacts should
be stored in a Vector<Person>
.
name
and phoneNumber
data items.
The name
items should be generated randomly. All your contacts should
be stored in a Vector<Person>
.
name
and phoneNumber
data items.
The name
items should be generated in reverse aphabetical order. All your contacts
should be stored in a Vector<Person>
.
Run all test cases 10 times and make a table with the running time for each run, as well as the average and the standard deviation for each test case. Make sure that you re-create your 10,000 contacts for each test case.
Please submit the completed assignment on Blackboard. You must submit your Java programs as a zip file of your Eclipse project.