

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


The purpose of this assignment is to learn to analyze algorithms using a profiling tool and report on your conclusions.
Write a short program that fills six arrays of 10 integers with the same random integer values, sorts them using the Sink, Selection, Insertion, QuickSort (original), QuickSort (median-of-three), and Shell (gap determined using 2.2) routines. The algorithms and code are given in the slides and/or in the course notes. In successive executions of the program, repeat the process with data that has the following characteristics. Already in order In reverse order Constant - every value the same Almost in order – about a random 10% of the values out of order Almost random data – about a random 10% in order.
Now repeat the entire process with arrays of 100 integers and then with arrays of 1000 integers. Finally, repeat the process with 5000 integers in the arrays. Because of the recursive nature of some of the routines and the expanding array sizes, you may reach a point where increasing N causes an error due to resource limitations of your machine. If so, don’t try to resolve the problem – just stop there. For each run of the program, profile the execution, paying particular attention to the performance of the sort routines. Record the profiles in tabular format to make it easy to compare the profiles between the routines, the different values of N, and the different data set characteristics. Use a spreadsheet program (e.g., Excel ) to record, format, and analyze your data. Every table, row, and column must be labeled with a meaningful label. Use the spreadsheet program to produce a meaningful graph showing comparisons of the algorithms for each data set. In analyzing the data, you are looking for patterns so that you can draw conclusions such as those illustrated by the following statements. The phrases in the list are not the particular observations expected, but they should give you suggestions as to the types of patterns you are seeking. If you see a pattern, you may want to test it with other data to verify the conclusions. The difference between the run time for the Insertion and Sinking sorts < .0001 second in all cases The Quick Sort is always faster than the Selection Sort on random data but the Selection Sort is faster on data that is already sorted If the number of entries goes up by a factor of 5, the Quick Sort takes 5^2 times as long The Insertion Sort is useful for data sets that are almost ordered but is not good for random data The Sinking Sort works well for small data sets but not for data sets of 1000 or more items Look for patterns involving the same algorithm with different values of N , different algorithms with the same data sets, and the same algorithm with data sets that have different characteristics but the same N. November 30, 2020 Page 1 of 2
You are seeking answers to such questions as the following: Is there a set of data characteristics that would cause me to choose sorting algorithm X over the others? Is there an algorithm that is always best regardless of the data characteristics? Is there a set of data characteristics for which I should always avoid using algorithm Y? Is there a set of algorithms that are roughly equal in performance so that it doesn’t make much difference which I choose from that set? Is there an algorithm that I should never use regardless of the data characteristics when there are more than ___ (fill in the blank) items to sort? Are there any obvious improvements I can make to any of the algorithms, and what evidence do I have for the expected improvement? Your test program should be very simple. In order to compare the profiles of the algorithms, you should run each test on one set of data, record the profile information, and then modify the program slightly (say, increase N by a factor of 10 or change the data from random to already sorted) and run it again. Use the fill, generate, or other algorithms from
Turn in a copy of one of the program iterations, a copy of the spreadsheet(s) and graphs produced, and a word-processed report of your observations and conclusions. Refer to the spreadsheet tables for the data to support your conclusions. The report should also state theoretical findings such as a big-O analysis if and where you can. Does your data confirm the theoretical analysis? If not, why? The spreadsheets and the report should include graphs that illustrate your points. The report should have the “typical” sections such as introduction, problem statement, work done and observation made based on the data, and conclusions that you reached. It should have a cover (title) page and use footnotes or similar stylistic techniques to associate your stated observations with the basis for them in the data. Use stylistic tools such as headers to organize your report and make it both attractive and easy to read. Use tools that are commonly available to you such as spell checkers, grammar checkers, and so forth to improve the quality of your report. Please use an .xls or .xlsx extension (format) for the spreadsheets and a .doc or .docx extension/format for the Word document (that is, don’t expect the grader and me to have every version of every open source or bootlegged word processor and spreadsheet program there is). Submit everything as part of a zipped file with an appropriate name using the drop box as usual. There is no minimum length for the report, but using extra words and huge fonts just to make the report longer is not appropriate and will not improve your grade. Please use common fonts, font sizes, margins, etc. A rule of thumb is to make reports as concise and simple as possible , but not more concise or simple than that. Your grade will be based on the data you collect, the format in which you present it, the analysis, and conclusions in your paper, and on the quality of the writing. Be as concise as possible, but provide convincing evidence for your conclusions. You may use the ETSU or College of Business and Technology writing labs to help achieve the best grade. November 30, 2020 Page 2 of 2