Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Benchmarking Algorithms Summary: In this homework, you will be implementing code to generate test data and benchmark sorting 1 Background In this assignment you will

image text in transcribed

image text in transcribed

Benchmarking Algorithms Summary: In this homework, you will be implementing code to generate test data and benchmark sorting 1 Background In this assignment you will practice predicting and verifying the impact of data "nature" on the run-time of sorting algorithms. As we have seen with algorithms like insertion sort, the runtime (even worse case like Big-Oh) can be impacted by the nature of the input To do this, we will create three different types of input data, that may give different results when sorted Two sorting algorithms will then be benchmarked on these three types of data. Each algorithm will be run twice, for different dataset sizes, in order to get times that we can use to apply the doubling formula. (See slide 23 (Modeling Small Datasets) in the Analysis of Algorithms slide deck for details on the doubling formula.) The doubling formula i b. If we compute the formula, then we will be able to figure out the algorithm's Big-Oh for a particular type of input data, since they will be 0(n, b is simply the r details on =b. Ifwe computorithmsslide deck T(2N l is 19 out the algorithm's Big for power This document is separated into four sections: Background, Requirements, Testing, and Submission You have almost finished reading the Background section already. In Requirements, we will discuss what is expected of you in this homework. In Testing, we suggest some basic tests you use to start to verify your implementation. Lastly, Submission discusses how your source code should be submitted on BlackBoard 2 Requirements |35 points For this assignment you will be writing code to generate test data, as well as benchmark sorting algorithms on it (edited from Sedgewick and Wayne: 2.1.36) First, write a series of methods that generate test data that is "non- rm Half the data is Os, half . Half the data is 0s, half the remainder is 1s, half the reminder is 2s, and so forth. [5 points] . Half the data is 0s, half random int values (can use next!nt() from Java's Random package) 15 points Each of these three techniques should be implemented as a static method that takes a integer repre- senting with the corresponding rule. Randomize (shuffle) the contents of the array after you populate it ase and an integer array containing um me ene Using the three methods you implement, develop 1 test hypotheses about the effect of input on the performance of two of the algorithms (your choice) we have covered. (Get their source code from BlackBoard.) . The program should contain your hypotheses (3 per algorithm) as comments: describe what you think the running time will look like (O(n)? O(n2)? O(n3)?) on each data set, and explain briefly why you think that. As long as your ideas make sense, you ill receive full credit on the hypotheses. [8 points] o For each of the two sorting algorithms, you should run them on the three types of test data. Test them with datasets size of 2048 and 4096. Time each of these twelve tests with the Stopwatch class given in class. (If your system is so fast you don't get good results, you may increase the dataset size.) [6 points o Display the result of applying the doubling formula to the run times from the 2048 and 4096 test pairs to get the power ("b" for that algorithm on that type of input. [6 points Benchmarking Algorithms Summary: In this homework, you will be implementing code to generate test data and benchmark sorting 1 Background In this assignment you will practice predicting and verifying the impact of data "nature" on the run-time of sorting algorithms. As we have seen with algorithms like insertion sort, the runtime (even worse case like Big-Oh) can be impacted by the nature of the input To do this, we will create three different types of input data, that may give different results when sorted Two sorting algorithms will then be benchmarked on these three types of data. Each algorithm will be run twice, for different dataset sizes, in order to get times that we can use to apply the doubling formula. (See slide 23 (Modeling Small Datasets) in the Analysis of Algorithms slide deck for details on the doubling formula.) The doubling formula i b. If we compute the formula, then we will be able to figure out the algorithm's Big-Oh for a particular type of input data, since they will be 0(n, b is simply the r details on =b. Ifwe computorithmsslide deck T(2N l is 19 out the algorithm's Big for power This document is separated into four sections: Background, Requirements, Testing, and Submission You have almost finished reading the Background section already. In Requirements, we will discuss what is expected of you in this homework. In Testing, we suggest some basic tests you use to start to verify your implementation. Lastly, Submission discusses how your source code should be submitted on BlackBoard 2 Requirements |35 points For this assignment you will be writing code to generate test data, as well as benchmark sorting algorithms on it (edited from Sedgewick and Wayne: 2.1.36) First, write a series of methods that generate test data that is "non- rm Half the data is Os, half . Half the data is 0s, half the remainder is 1s, half the reminder is 2s, and so forth. [5 points] . Half the data is 0s, half random int values (can use next!nt() from Java's Random package) 15 points Each of these three techniques should be implemented as a static method that takes a integer repre- senting with the corresponding rule. Randomize (shuffle) the contents of the array after you populate it ase and an integer array containing um me ene Using the three methods you implement, develop 1 test hypotheses about the effect of input on the performance of two of the algorithms (your choice) we have covered. (Get their source code from BlackBoard.) . The program should contain your hypotheses (3 per algorithm) as comments: describe what you think the running time will look like (O(n)? O(n2)? O(n3)?) on each data set, and explain briefly why you think that. As long as your ideas make sense, you ill receive full credit on the hypotheses. [8 points] o For each of the two sorting algorithms, you should run them on the three types of test data. Test them with datasets size of 2048 and 4096. Time each of these twelve tests with the Stopwatch class given in class. (If your system is so fast you don't get good results, you may increase the dataset size.) [6 points o Display the result of applying the doubling formula to the run times from the 2048 and 4096 test pairs to get the power ("b" for that algorithm on that type of input. [6 points

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Advances In Databases And Information Systems 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students also viewed these Databases questions

Question

4. Why cant we consciously recall learning to walk?

Answered: 1 week ago