Question: Lab 1 0 : Run time for Sorting algorithms For this lab assignment you will need to write some code and create some graphs. You
Lab : Run time for Sorting algorithms
For this lab assignment you will need to write some code and create some graphs. You may use excel to
create your graphs, or other language of your choice. Your data needs to demonstrate the experimental
running time for Selection Sort code in book Merge Sort code in book and the Arrays.sort method.
Here is a basic outline of how you need to code this assignment.
Create several arrays of size you need to choose max
size appropriately
Start the stop watch class provided in book
Sort the array
Stop the stop watch
Print or write to a file the size of the array and the time it took to sort.
You will follow the above outline for each sorting algorithm. You will need to plot size of array xaxis vs
time yaxis on a loglog scale. This can be done easily in excel You should have all three sets of data
on the same graph. so use the same array sizes for all testsOn a loglog scale, all data should be a
straight line, but the slope of a On algorithm will be higher than an On log n algorithm I have an
example shown below of a graph of functions on a loglog scale.
E
Growth Rate
n
n
n n
input size n
growth rate
You also need to include plots on a standard scale. Create a single graph with all three sorting
algorithms data on that single plot.
You may print your values to the screen and copy paste into excel. Or you may create CSV files and
open them directly with excel. CSV file is simply a text file, with values separated by commas CSV
stands for Comma Separated Values
To Turn In
Turn in your java code, your excel files or whatever you used to create your visualization and a PDF
document with your chart, and a short report pages describing how you did this assignment, and
the differences between the run times of the algorithms you tested. You can find the run times of all
algorithms on the internet. Did your experiments line up with your expectations of run time?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
