Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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 2K-1, 2k-1-1, ..., 3, 1, where k = log 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), 5x10, 109, 5x104, 10%), 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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions