Homework 3, The problem with Asymptotic Analysis.
Short Description:
Investigate the wall clock performance time of Bubble and Insertion sort.
Goals
When you finish this homework, you should have:
- Learned something about the actual performance of two asymptotically similar algorithms.
Formal Description
For this homework you need to compare the actual performance of two sorts from the previous assignment. I have performed this experiment using this framework to test the timing performance of selection sort. Please feel free to use some or all of this code. Coding is not the challenge of this exercise, the analysis of the results is. If you wish, I will discuss this code in class, just ask.
Implement the two sorting algorithms from this homework.
After you have implemented these algorithms, perform a series of timing experiments, counting the number of comparisons, data moves and total milliseconds spent in each sort. You should sort between 1,000 and 10,000 elements that have been randomly generated on the range [0 to 1,000,000] ten times each.
Produce a table for your two sorts and selection sort that presents the average time, comparisons and data moves for each different array size. Produce several graphical depictions of this table. I would use excel and generate a pivot table to do this. If you need assistance, please ask.
Write a report describing your findings and interpreting the results. Your report should follow the IMRD format
- Introduction: provide a brief introduction to the experiment.
- Methods: describe what you did and the conditions when you did it.
- Results: present the results of your experiments, without commentary.
- Discussion: discuss what you found and draw conclusions.
Notes
Please do not optimize your code, of if you do, include a presentation of non-optimized results as well. Code is optimized with any of the following flags: -O1, -O2, -O3, -Os, -Ofast -Og, -Oz. Generally we turn optimization on to help detect uninitialized variables.
You may use components of the standard library, my framework relies on these heavily. You must, however, implement the sorting algorithms yourself.
I encourage you to use the chronos library for time and the random library for random number generation. You may use my framework and are excused from deep knowledge of these libraries.
If you wish, my Makefile is here.
Required Files
A zip or tar file containing
- Your final code
- Your report
Submission
Submit the assignment to the D2L folder Homework 3 by the due date.