This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: array). d. In HOAREPARTITION, 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 ← HOAREPARTITION (A, p, r) 3 QUICKSORT HOARE (A, p, q  1) 4 QUICKSORT HOARE (A, q + 1, r)...
View
Full Document
 Spring '09
 Dr.Ayman
 Algorithms, Prime number, Equals sign, Partitions of Poland, 0 0 1 3 1 2 2 9 4 4 4 4 10 J

Click to edit the document details