京都大学 情報学研究科 知能情報学専攻 2019年2月実施 専門科目 F1-1
标签:
Author
Description
Q.1
Given two sequences of length , write pseudocode of an -time algorithm to find a longest common subsequence. Note that a subsequence does not necessarily have to be contiguous. For example, if and , the sequence is a common (but not longest) subsequence of and .
Q.2
Given a sequence of permuted integers from 1 to , write pseudocode of an -time algorithm to find the length of the longest monotonically increasing subsequence.
题目描述
- 给定两个长度均为 的序列,写出一个 时间算法的伪代码,求一个最长公共子序列。子序列不要求连续;例如 、 时, 是公共子序列,但不是最长者。
- 给定由整数 的一个排列构成的序列,写出一个 时间算法的伪代码,求最长严格单调递增子序列的长度。
考点
- 最长公共子序列动态规划:以两个前缀为状态,根据末元素是否相等建立二维递推,并恢复一个最优子序列。
- 最长递增子序列:维护各长度递增子序列的最小末尾值,并用二分查找将复杂度降为 。