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: array). d. In HOARE-PARTITION, it searches the array for an element smaller than x, and an element greater than x. but it swaps these two elements only if the index of the smaller element is greater than the index of the greater element. And that leads us to divide the array into two partitions where every element in the first partition is smaller than or equal to all elements in the second partition. e. QUICKSORT HOARE(A, p, r) 1 if p < r 2 then q HOARE-PARTITION (A, p, r) 3 QUICKSORT HOARE (A, p, q - 1) 4 QUICKSORT HOARE (A, q + 1, r)...
View Full Document
This note was uploaded on 11/09/2010 for the course CS 11841 taught by Professor Dr.ayman during the Spring '09 term at Alexandria University.
- Spring '09