You do not need to do all three parts, each part is worth 8 1/3% of the test.
Exceptionally well done reports may result in additional credit.
Insertion sort algorithm. As stated in class, swapping the element to the right place in the array is less efficient than moving the array up and only inserting the element once a space has been opened. How important is this? Implement the improved algorithm and test the performance of this implementation against the original algorithm.
Cocktail Shaker Sort. This sort is an extension of the bubble sort. One version of this algorithm:
Compiler optimization. The gcc compiler supports multiple levels of optimization. By default there is no optimization, but the following flags provide high level optimization
| Flag | Effect |
|---|---|
| -O1 | Basic Optimization, the compiler does what it can quickly |
| -O2 | Moderate Optimization, increased compile time leads to better code performance |
| -O3 | Aggressive Optimization, a potential for greatly increased compile time but a chance for much better code performance |
You can change the compiler optimization by adding that value to the CXXFLAGS line in the Makefile, or if you compile by hand, adding the flag to the compiler command.
Write a report describing your findings and interpreting the results. Your report should follow the IMRD format
Please note, your discussion must include at least one graph, table and a discussion comparing these sorts to the sorts in the last assignment.
Please include a graph providing a timing performance for all of the sorts consider (bubble, bad insertion, improved insertion, cocktail shaker and compiler optimization). If you only perform part of this assignment, you are not responsible for the graphs for the parts you do not do.
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.