Unformatted text preview: CS 473 Homework 9 (due April 27, 2010) Spring 2010 1. We say that an array A [ 1 .. n ] is ksorted if it can be divided into k blocks, each of size n / k , such that the elements in each block are larger than the elements in earlier blocks, and smaller than elements in later blocks. The elements within each block need not be sorted. For example, the following array is 4sorted: 1 2 4 3 7 6 8 5 10 11 9 12 15 13 16 14 (a) Describe an algorithm that ksorts an arbitrary array in time O ( n log k ) . (b) Prove that any comparisonbased ksorting algorithm requires Ω( n log k ) comparisons in the worst case. (c) Describe an algorithm that completely sorts an already ksorted array in time O ( n log ( n / k )) . (d) Prove that any comparisonbased algorithm to completely sort a ksorted array requires Ω( n log ( n / k )) comparisons in the worst case. In all cases, you can assume that n / k is an integer and that n ! ≈ n e n ....
View
Full Document
 Spring '08
 Chekuri,C
 Algorithms, Sort, Analysis of algorithms, match, worst case, The Egg

Click to edit the document details