{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# lab9 - 15-121 Fall 2009[CORTINA/REID-MILLER RECITATION 9...

This preview shows pages 1–2. Sign up to view the full content.

15-121 Fall 2009 [CORTINA/REID-MILLER] RECITATION 9 From www.math.bas.bg/~nkirov In this lab, you will complete implementations of two divide-and-conquer sorting methods. EXERCISES Download 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 using the Divide & Conquer (and Combine) technique. 1. In the Merge Sort algorithm, we split the array into two halves ( Divide ), sort the two halves recursively using Merge Sort ( Conquer ), and then merge the two sorted arrays back together to form our final sorted result ( Combine ). 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

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

lab9 - 15-121 Fall 2009[CORTINA/REID-MILLER RECITATION 9...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online