Question: In C++ In this project you will write a program that compares the actual performance, with respect to actual running times and numbers of comparisons

In C++

In C++ In this project you will write a program that compares

In this project you will write a program that compares the actual performance, with respect to actual running times and numbers of comparisons performed, of the five comparison-based sorting algorithms you learned in class. Specifically, you need to complete the following steps: 1. (100 pts) Implement the five comparison sorts (selection, insertion, Shell, quick-and merge sorts) given in class according to their pseudocode provided in the zyBook, and include them in one Java/C++ class. For Shell sort, use the gap values 2-1, 2-2-1, ..., 3, 1, where k = Llog nj and n is the length of the input array. 2. (50 pts) Write code in your "main" function that performs the following: a) For each ne {10}, 5x103, 104, 5x104, 105}, randomly generate 5 integer arrays of length n. b) Run each of the five comparison sorts you implemented in Step 1 on all the five arrays generated in Step 2.a and record the worst-case actual running time and number of comparisons performed among elements in the input array. 3. (20 pts) Save the results from 2(b) in one or two tables and include them in your project report. 4. (30 pts) Discuss the following in your project report based on your results from Step 3: a) Do the numbers of comparisons performed reasonably reflect the overall running times of the corresponding algorithm? If not, what are the possible reasons. Does the size of the input array have any significant effect? b) is the performance of the studied algorithms with respect to actual running time and number of comparisons performed consistent with their theoretical time complexity? If not, what are the possible reasons? 5. (40 pts) Include the following in your report, in addition to the information described in steps 3 and 4: a) List of files submitted, b) Readme file containing instructions for running your project, if necessary, and c) Testing code in your "main" function and screen shots of sample runs, showing the correctness of your program. 6. (10 pts) Make sure all your code contains sufficient comments and is reasonably readable. In this project you will write a program that compares the actual performance, with respect to actual running times and numbers of comparisons performed, of the five comparison-based sorting algorithms you learned in class. Specifically, you need to complete the following steps: 1. (100 pts) Implement the five comparison sorts (selection, insertion, Shell, quick-and merge sorts) given in class according to their pseudocode provided in the zyBook, and include them in one Java/C++ class. For Shell sort, use the gap values 2-1, 2-2-1, ..., 3, 1, where k = Llog nj and n is the length of the input array. 2. (50 pts) Write code in your "main" function that performs the following: a) For each ne {10}, 5x103, 104, 5x104, 105}, randomly generate 5 integer arrays of length n. b) Run each of the five comparison sorts you implemented in Step 1 on all the five arrays generated in Step 2.a and record the worst-case actual running time and number of comparisons performed among elements in the input array. 3. (20 pts) Save the results from 2(b) in one or two tables and include them in your project report. 4. (30 pts) Discuss the following in your project report based on your results from Step 3: a) Do the numbers of comparisons performed reasonably reflect the overall running times of the corresponding algorithm? If not, what are the possible reasons. Does the size of the input array have any significant effect? b) is the performance of the studied algorithms with respect to actual running time and number of comparisons performed consistent with their theoretical time complexity? If not, what are the possible reasons? 5. (40 pts) Include the following in your report, in addition to the information described in steps 3 and 4: a) List of files submitted, b) Readme file containing instructions for running your project, if necessary, and c) Testing code in your "main" function and screen shots of sample runs, showing the correctness of your program. 6. (10 pts) Make sure all your code contains sufficient comments and is reasonably readable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!