Unformatted text preview: penalty for that day is (200x ) 2 . You want to plan your trip so as to minimize the total penalty–that is, the sum over all travel days, of the daily penalties. Give an eﬃcient algorithm that determines the optimal sequence of hotels at which to stop. Problem 3. [Longest Common Subsequence] Let A [1 ...m ] and B [1 ...n ] be two arbitrary arrays. A common subsequence of A and B is another sequence that is a subsequence of both A and B . Describe an eﬃcient algorithm to compute the length of the longest common subsequence of A and B . A subsequence is anything obtained from a sequence by extracting a subset of elements, but keeping them in the same order; the elemtns of the subsequence need not be contiguous in the original sequence. For example, the strings C , DAMN , and YAIOAI , and DYNAMICPROGRAMMING are all subsequences of the sequence DYNAMICPROGRAMMING . 1...
View
Full Document
 Fall '08
 Chekuri,C
 Algorithms, Array, Penalty, subsequence, longest common subsequence, contiguous subarray

Click to edit the document details