hw9 - CS 473 Homework 9(due Spring 2010 1 We say that an...

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: CS 473 Homework 9 (due April 27, 2010) Spring 2010 1. We say that an array A [ 1 .. n ] is k-sorted 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 4-sorted: 1 2 4 3 7 6 8 5 10 11 9 12 15 13 16 14 (a) Describe an algorithm that k-sorts an arbitrary array in time O ( n log k ) . (b) Prove that any comparison-based k-sorting algorithm requires Ω( n log k ) comparisons in the worst case. (c) Describe an algorithm that completely sorts an already k-sorted array in time O ( n log ( n / k )) . (d) Prove that any comparison-based algorithm to completely sort a k-sorted 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

{[ snackBarMessage ]}

Ask a homework question - tutors are online