This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 15-121 FALL 2009 [CORTINA]LAB 9From www.math.bas.bg/~nkirovIn this lab, you will complete implementations of two divide-and-conquer sorting methods. EXERCISESDownload the project Lab9.zip. It contains two classes, one to implement the Merge Sort algorithm and one to implement the Quick Sort algorithm. Both algorithms sort a collection of data stored in an array into non-decreasing order. See your course notes for Unit 7B for an example. 1. In the Merge Sort algorithm, we split the array into two halves, sort the two halves recursively using Merge Sort, and then merge the two sorted arrays back together to form our final sorted result. When we merge the two sorted subarrays back into one, we examine the first element in each subarray to determine which value moves into the first position of the merged array. We then examine the first element that remains in each subarray to determine which value moves into the next position of the merged array. We repeat the previous step over and over until we run out of elements from one of the merged array....
View Full Document
This note was uploaded on 12/19/2009 for the course CS 121 taught by Professor Reid-miller during the Spring '09 term at Carnegie Mellon.
- Spring '09