# hbs9(1) - not yet removed from consideration where each...

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

CS 473 HBS 9 Spring 2009 CS 473: Undergraduate Algorithms, Spring 2009 HBS 9 1. Prove that any algorithm to merge two sorted arrays, each of size n , requires at least 2 n - 1 comparisons. 2. Suppose you want to determine the largest number in an n -element set X = { x 1 , x 2 ,..., x n } , where each element x i is an integer between 1 and 2 m - 1. Describe an algorithm that solves this problem in O ( n + m ) steps, where at each step, your algorithm compares one of the elements x i with a constant . In particular, your algorithm must never actually compare two elements of X ! [Hint: Construct and maintain a nested set of ‘pinning intervals’ for the numbers that you have
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: not yet removed from consideration, where each interval but the largest is either the upper half or lower half of the next larger block.] 3. Let P be a set of n points in the plane. The staircase of P is the set of all points in the plane that have at least one point in P both above and to the right. Prove that computing the staircase requires at least Ω( n log n ) comparisons in two ways, (a) Reduction from sorting. (b) Directly. 1...
View Full Document

## This note was uploaded on 01/22/2012 for the course CS 573 taught by Professor Chekuri,c during the Fall '08 term at University of Illinois, Urbana Champaign.

Ask a homework question - tutors are online