This preview shows page 1. Sign up to view the full content.
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
This note was uploaded on 01/21/2011 for the course CS 473 taught by Professor Chekuri,c during the Spring '08 term at University of Illinois, Urbana Champaign.
 Spring '08
 Chekuri,C
 Algorithms, Sort

Click to edit the document details