CMPE 250 – DATA STRUCTURES & ALGORITHMS

 

Project #3

 

Due: 7.8.2005 Sunday at 12:00 PM

 

Comparison of Sorting Algorithms

 

In this project, you will compare different sorting methods. For each method, you will use various data (to be sorted) that has specific characteristics. Then, you will compare time complexities of each sorting method.

 

Sorting Methods

You will implement the following sorting methods. Each method sorts the data in ascending order.

 

·        Insertion Sort

·        Shell Sort

·        Quick Sort: Use Median-of-Three pivot picking method.

 

Data to be Sorted

There will be three different datasets (whose elements are of type long) to be sorted. You will generate these datasets in your program. Each dataset will be of size N (i.e. 10000), covering a range of values from 1 to N (no duplicates allowed).

 

·        Presorted Data : Already sorted in ascending order.

·        Reverse Ordered Data : Already sorted in decreasing order.

·        Fully Random Data

 

Your program will get two inputs from the user: 1) dataset size (N), 2) Sorting algorithm (1:Insertion sort, 2:Shell sort, 3: Quick Sort). Program will output the execution timings for 3 datasets (Presorted, Reverse Ordered, Random). For random dataset, you have to perform 10 independent runs, and then give the average sorting execution time. For each method, you will report timings to sort each dataset. Show all the results in one table.

 

Implementation Details

·        Try to use object oriented concepts as much as possible.

·        Make sure your code compiles with JDK 5.0.

 

 NOTES: