m design an on log n time algorithm for computing the

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: uard can protect all the paintings within distance at most 1 of his or her position (on both sides). Design an algorithm for finding a placement of guards that uses the minimum number of guards to guard all the paintings with positions in X . C-5.6 Design a divide-and-conquer algorithm for finding the minimum and the maximum element of n numbers using no more than 3n/2 comparisons. C-5.7 Given a set P of n teams in some sport, a round-robin tournament is a collection of games in which each team plays each other team exactly once. Design an efficient algorithm for constructing a round-robin tournament assuming n is a power of 2. C-5.8 Let a set of intervals S = {[a0 , b0 ], [a1 , b1 ], . . . , [an−1 , bn−1 ]} of the interval [0, 1] be given, with 0 ≤ ai < bi ≤ 1, for i = 0, 1, . . . , n − 1. Suppose further that we assign a height hi to each interval [ai , bi ] in S. The upper envelope of S is defined to be a list of pairs [(x0 , c0 ), (x1 , c1 ), (x2 , c2 ), . . . , (xm , cm ), (xm+1 , 0)], with x0 = 0 and xm+1 = 1, and ordered by xi values, such that, for each subinterval s = [xi , xi+1 ] the height of the highest interval in S containing s is ci , for i = 0, 1, . . . , m. Design an O(n log n)-time algorithm for computing the upper envelope of S. C-5.9 How can we modify the dynamic programming algorithm from simply computing the best benefit value for the 0-1 knapsack problem to computing the assignment that gives this benefit? C-5.10 Suppose we are given a collection A = {a1 , a2 , . . . , an } of n positive integers that add up to N . Design an O(nN )-time algorithm for determining whether there is a subset B ⊂ A, such that ∑ai ∈B ai = ∑ai ∈A−B ai . Chapter 5. Fundamental Techniques 284 C-5.11 Let P be a convex polygon (Section 12.5.1). A triangulation of P is an addition of diagonals connecting the vertices of P so that each interior face is a triangle. The weight of a triangulation is the sum of the lengths of the diagonals. Assuming that we can compute lengths and add and compare them in constant time, give an efficient algorithm for computing a minimum-weight triangulation of P. C-5.12 A grammar G is a way of generating strings of “terminal” characters from a nonterminal symbol S, by applying simple substitution rules, called productions. If B → β is a production, then we can convert a string of the form αBγ into the string αβγ. A grammar is in Chomsky normal form if every production is of the form “A → BC” or “A → a,” where A, B, and C are nonterminal characters and a is a terminal character. Design an O(n3 )-time dynamic programming algorithm for determining if string x = x0 x1 · · · xn−1 can be generated from start symbol S. C-5.13 Suppose we are given an n-node rooted tree T , such that each node v in T is given a weight w(v). An independent set of T is a subset S of the nodes of T such that no node in S is a child or parent of any other node in S. Design an efficient dynamic programming algorithm to find the maximum-weight independent set of the nodes in T , where the weight of a set of nodes is simply the sum of the weights of the nodes in that set. What is the running time of your algorithm? Projects P-5.1 Design and implement a big integer package supporting the four basic arithmetic operations. P-5.2 Implement a system for efficiently solving knapsack problems. Your system should work for either fractional or 0-1 knapsack problems. Perform an experimental analysis to test the efficiency of your system. Chapter Notes The term “greedy algorithm” was coined by Edmonds [64] in 1971, although the concept existed before then. For more information about the greedy method and the theory that supports it, which is known as matroid theory, please see the book by Papadimitriou and Steiglitz [164]. The divide-and-conquer technique is a part of the folklore of data structure and algorithm design. The master method for solving divide-and-conquer recurrences traces its origins to a paper by Bentley, Haken, and Saxe [30]. The divide-and-conquer algorithm for multiplying two large integers in O(n1.585) time is generally attributed to the Russians Karatsuba and Ofman [111]. The asymptotically fastest known algorithm for multiplying two n-digit numbers is an FFT-based algorithm by Sch¨ nhage and Strassen [181] that runs o in O(n log n log log n) time. Dynamic programming was developed in the operations research community and formalized by Bellman [26]. The matrix chain-product solution we described is due to Godbole [78]. The asymptotically fastest method is due to Hu and Shing [101, 102]. The dynamic programming algorithm for the knapsack problem is found in the book by Hu [100]. Hirchsberg [95] shows how to solve the longest common substring problem in the same time given above, but with linear space (see also [56])....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online