
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!

CSC 8301 Project 2 : Comparing Sorting Algorithms, Summer 2004, Dr. Joyce Goals : Perform an empirical comparison of variations of two sorting algorithms Points : 70 Due : June 29th^ at the beginning of class General Description : You will code two variations of the Bubblesort algorithm and two variations of the Quicksort algorithm. Your code will count the number of comparisons and the amount of computer time, required during the sorting process. You will run your program(s) on various sizes and types of lists and collect the resulting data. You will analyze the data and create a report that presents your programs, data collected, and analysis. You may use whatever language/system you prefer. You must place all source code files in the subdirectory csc8301/project2 of your departmental UNIX account. The Algorithms : Bubblesort : As defined in Project 1. Feel free to reuse your code. Smart Bubblesort : Every other sweep through the array will move in the alternate direction. This approach was called the "Shaker Sort" in the Sorting out Sorts video. You will track where the last swap of values occurred during each sweep, and begin the subsequent sweep at that location, taking advantage of the knowledge that all the values between that index and the "end" of the array are in their final location. Quicksort : As defined on pages 128 and 129. Tri-Sample Quicksort : As described on page 132, researchers have attempted to tweak the Quicksort algorithm to attain marginal improvements. Use the "median-of-three" approach described there for selecting the pivot value for Quicksort. The Lists to be Sorted : List Sizes : Investigate lists of size N where N = 1000, 5000, 10000 List Types : Random : Each element is a random integer in the range 0 .. N- 10% Random : Start with a sorted list of integers where the value in position i of the list is i. Randomly select 10% of the positions on the list (do not worry about selecting the same position twice) and replace the value in those positions with a random integer in the range 0 .. N-1. 0.5% Random : Start with a sorted list of integers where the value in position i of the list is i. Randomly select 0.5% of the positions on the list (do not worry about selecting the same position twice) and replace the value in those positions with a random integer in the range 0 .. N-1. The Data Collected : Number of Samples : For each "input" condition, collect data from three runs of the algorithm, using a unique seed for your random number generator for each run, and report and analyze the average of the results. But be sure to use the same seeds "across" algorithms. Comparison Counts : Only count the number of comparisons of list elements made during the sorting process. Execution Time : Determine the amount of computer time spent during the sorting process. Do not include the time needed to set up the initial array, or any time used to verify that the final array is sorted. You may use whatever time units you think work best... maybe microseconds? Include a short section in your report describing how you measured the execution time. Report : Create a report, as you did for Project 1. You can determine the format, order of information, and so on, but be sure to include at least the following: Heading and Introduction sections similar to that used in Project 1. The Introduction should include a description of the general approach you used for the assignment. Code listings An explanation of how you measured execution time A description of how you tested your code, perhaps with some sample output from test runs An easy to read presentation of the data collected, perhaps using tables, or graphs, or both. An Analysis section where you describe the results and report on any insights provided by the data, plus whatever else you believe is appropriate/interesting A Conclusion