演算法›Ch3 動態規劃第 21 題/共 40 題
21. Dynamic Programming、Longest Increasing Subsequence、Palindrome
#AL-03-021難Dynamic ProgrammingLongest Increasing SubsequencePalindrome
- (14%) Recurrence formula is what it takes to solve a problem with the dynamic programming technique. In this problem we examine the recurrence formulas for two different sequence problems.
- Consider the longest increasing subsequence (LIS) problem. Let be the input sequence of n numbers. For any , let denote the maximum length of any increasing subsequence of A that ends at position i.
It is well-known that can be expressed as the following recurrence formula.
where in the formula we define for convenience. The answer to the input sequence is then given by .
- Next, consider the "Longest Palindrome Bimodal Subsequence Problem", which is defined as follows. Let be a sequence of n numbers. A subsequence of A is called a bimodal subsequence with pivot k, , if B is an increasing sequence before position k and a decreasing sequence after position k. That is, holds for all and holds for all . Furthermore, we say that a bimodal sequence with pivot k is a palindrome bimodal sequence if .
For any , let denote the maximum length of any palindrome bimodal subsequence of A that pivots at position i. Write down a valid recurrence formula for , as the format given above for for the LIS problem. You may define other auxiliary functions necessary to compose the recurrence formula for . However, make sure you provide a precise and succinct definition.
📄 交大113
▤完整推導請見《WH 資工筆記 · 演算法》Ch3 動態規劃