40 likes | 72 Views
Data Structures and Algorithms I Day 10, 10/6/11 Exam 1. CMP 338. Homework 9, due 11 pm 10/12. Implement insertion sort, merge sort, quicksort Compare performance of quicksort (four variations) insertion sort merge sort Turn in a) working code for all sort programs
E N D
Data Structures and Algorithms I Day 10, 10/6/11 Exam 1 CMP 338
Homework 9, due 11 pm 10/12 Implement insertion sort, merge sort, quicksort Compare performance of quicksort (four variations) insertion sort merge sort Turn in a) working code for all sort programs b) performance numbers (standard out) c) performance graphs d) your interpretation of the data
Homework 9 API public class Homework9(Homework9.java) public static void insertionSort(double[] a) public static void mergeSort(double[] a) public static void quicksort0(double[] a) public static void quicksort1(double[] a) public static void quicksort2(double[] a) public static void quicksort3(double[] a) All other methods are private and static (Including merge and partition) No other classes
Homework 9 API, Continued Don't bother randomizing quicksort input quicksort0 Pivot is a[lo] (standard partition) quicksort1 Pivot is median of a[lo], a[hi], and a[(hi+lo)/2] quicksort2 Pivot is median of a[lo..hi] Implement linear select algorithm Partition by median is a side-effect of the algorithm quicksort3 Pivot is first pivot of linear select algorithm