Overview: You will be creating a report comparing various sorting algorithms. You will be comparing these algorithms based on their actual execution time, as well as on the theoretical runtime as calculated by estimating the number of comparisons that will occur. When comparing the specific algorithms described in sections B-E of the guide, you will want to make sure to select implementations that minimize additional factors. For example, you may want to ensure that all of the algorithms are running “in-place” meaning that you are not allocating different amounts of memory for the data itself throughout the sorting process. Each algorithm will, of course, have different overhead, but we want to minimize the differences when possible.   Some datasets have been uploaded in D2L (The Hub) that you can use if you want, or you can feel free to generate your own.   Algorithms to Compare: 1. Selection Sort 2. Bubble Sort 3. Merge Sort 4. Quicksort 5. STL algorithm Useful Code for Execution Time Estimation:   #include #include #include //c style output "printf" using namespace std; void FunctionToTime() { int a; for (int i=0;i<100;i++){ a=i*i*i; cout <Settings, and add the following under Other Linker Settings: -Wl,-stack,3000000000

icon
Related questions
Question

Overview:

You will be creating a report comparing various sorting algorithms. You will be comparing these algorithms based on their actual execution time, as well as on the theoretical runtime as calculated by estimating the number of comparisons that will occur. When comparing the specific algorithms described in sections B-E of the guide, you will want to make sure to select implementations that minimize additional factors. For example, you may want to ensure that all of the algorithms are running “in-place” meaning that you are not allocating different amounts of memory for the data itself throughout the sorting process. Each algorithm will, of course, have different overhead, but we want to minimize the differences when possible.

 

Some datasets have been uploaded in D2L (The Hub) that you can use if you want, or you can feel free to generate your own.

 

Algorithms to Compare:

1. Selection Sort

2. Bubble Sort

3. Merge Sort

4. Quicksort

5. STL algorithm

Useful Code for Execution Time Estimation:

 

#include <ctime> #include <iostream> #include <stdio.h> //c style output "printf" using namespace std; void FunctionToTime() { int a; for (int i=0;i<100;i++){ a=i*i*i; cout <<a<<endl; } }

int main(){ clock_t begin = clock(); //Note: this code must actually do something FunctionToTime(); clock_t end = clock(); double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC; printf ("Elapsed time is %.9f seconds.", elapsed_secs ); return 0; }

Components:

● Implementations of Selection, Bubble, Merge, Quick sort algorithms.

● Comparisons of runtimes for each algorithm sorting 10, 100, 1000, 10000, 100000? random numbers.

● Summary of the number of comparisons of each algorithm in terms of the number of numbers being sorted N. Include an estimation of the worst, average, and best cases in terms of N. (Wikipedia and Google are your friends here)

● Explanation of an additional sort algorithm

For stack overflow issues in CodeBlocks, try this:

Go to Compiler->Settings, and add the following under Other Linker Settings:

-Wl,-stack,3000000000

Expert Solution
steps

Step by step

Solved in 6 steps

Blurred answer
Knowledge Booster
Mergesort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, data-structures-and-algorithms and related others by exploring similar questions and additional content below.