hbs3(1) - Each call to the oracle takes linear time in...

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

CS 473 HBS 3 Spring 2009 CS 473: Undergraduate Algorithms, Spring 2009 HBS 3 1. Change your recursive solutions for the following problems to efﬁcient algorithms (Hint: use dynamic programming!). (a) Consider two horizontal lines l 1 and l 2 in the plane. There are n points on l 1 with x -coordinates A = a 1 , a 2 ,..., a n and there are n points on l 2 with x -coordinates B = b 1 , b 2 ,..., b n . Design an algorithm to compute, given A and B , a largest set S of non- intersecting line segments subject to the following restrictions: i. Any segment in S connects a i to b i for some i (1 i n ). ii. Any two segments in S do not intersect. (b) Given a string of letters Y = y 1 y 2 ... y n , a segmentation of Y is a partition of its letters into contiguous blocks of letters (also called words). Each word has a quality that can be computed by a given oracle (e.g. you can call quality("meet") to get the quality of the word "meet"). The quality of a segmentation is equal to the sum over the qualities of its words.
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Each call to the oracle takes linear time in terms of the argument; that is quality( S ) takes O ( | S | ) . Using the given oracle, give an algorithm that takes a string Y and computes a segmentation of maximum total quality. 2. Give a polynomial time algorithm which given two strings A and B returns the longest sequence S that is a subsequence of A and B . 3. Consider a rooted tree T . Assume the root has a message to send to all nodes. At the beginning only the root has the message. If a node has the message, it can forward it to one of its children at each time step. Design an algorithm to ﬁnd the minimum number of time steps required for the message to be delivered to all nodes. 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