In this assignment you will be implementing and testing all three sort algorithms: Bubble Sort , Selection Sort , and Insertion Sort .
In additions, you will also be writing a driver to test the search algorithms and you will be measuring the run times of each search.
You will also be using the RunTime
class that you created for Homework 1.
Finally, you will be analysing and comparing the performance of the three sort algorithms based on the type of array that was being sorted and the run times you computed.
You will copy the RunTime
class that you created in Homework 1 to the
project you are using for this assignment.
You will write the BubbleSort.java
class which will inherit from
RunTime.java
and implement the
Sort Interface
using the
Bubble Sort
algorithm. The interface may be downloaded from
SortInterface.java
Please note that your sort
method must measure the run time and add it to the
RunTime
class by using the addRunTime()
method.
You will write the SelectionSort.java
class which will inherit from
RunTime.java
and implement the
Sort Interface
using the
Selection Sort
algorithm. The interface may be downloaded from
SortInterface.java
Please note that your sort
method must measure the run time and add it to the
RunTime
class by using the addRunTime()
method.
You will write the InsertionSort.java
class which will inherit from
RunTime.java
and implement the
Sort Interface
using the
Insertion Sort
algorithm. The interface may be downloaded from
SortInterface.java
Please note that your sort
method must measure the run time and add it to the
RunTime
class by using the addRunTime()
method.
You will write the Driver.java
class which will implement the
Driver Interface
. The interface may be downloaded from
DriverInterface.java
Please note that, in addition to implementing the DriverInterface
, you are also required to write
your own public static main(String[] args)
method in Driver.java
.
Your main()
method will have to call the runSort()
method to sort each of the following array types
ten times for each sort algorithm:
Integer
s.
Integer
s.
Integer
s.
Integer
s.
Integer
s.
Integer
s.
Integer
s.
Integer
s.
Integer
s.
Integer
s.
For each call to the runSort()
method to sort an ArrayType
using a
SortType
ten times, your
main()
method will produce the following output:
SortType
,ArrayType
,Array Size
-------------------------------------------------------------------------------------------------------------- runTime1 runTime2 runTime3 runTime4 runTime5 runTime6 runTime7 runTime8 runTime9 runTime10 --- Average runTime
Using the run time tables you created by running Driver.main(), copy your results into a Microsoft Word document and answer the following questions using 1-3 complete sentences for each question:
Please make sure that all your java classes are in the correct package.
Please submit your analysis on Blackboard as a typed Microsoft Word file (.docx). No other forms of submission will be accepted.
Please submit the completed programming assignment on the
Mimir Platform Website
.
You must submit your Java programs as a zip file of only the classes specified above.