Question
Lab 11 Timing For Sorting Algorithms For this lab assignment you will need to write some code and create some graphs. You may use excel
Lab 11 Timing 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 you may use python (or some 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 100, 1000, 10000, 100000, 1000000, (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 (x-axis) vs time (y-axis) on a log-log 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 3 tests). (On a log-log scale, all data should be a straight line, but the slope of a O(n2)algorithm will be higher than an O(n log n) algorithm). I have an example shown below of a graph of 3 functions on a log-log scale.
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).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started