{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hbs2(1) - 3 Given a string of letters Y = y 1 y 2 y n a...

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

View Full Document Right Arrow Icon
CS 473 HBS 2 Spring 2009 CS 473: Undergraduate Algorithms, Spring 2009 HBS 2 1. 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: (a) Any segment in S connects a i to b i for some i (1 i n ). (b) Any two segments in S do not intersect. 2. Consider a 2 n x 2 n chess board with one (arbitrarily chosen) square removed. Prove that any such chessboard can be tiled without gaps or overlaps by L-shaped pieces of 3 squares each. Can you give an algorithm to do the tiling? 3.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 3. 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. 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. 1...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online