注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
本帖最后由 hanrui_542 于 2012-4-11 02:48 编辑
Longest Increasing Subsequence 最常见的就是用Dynamic Programming,通常用这个recurrence relation:A(i) = 1 + max{A(j)| 1 ≤ j < i and a_j < a_i}. 用divide and conquer方法在写recurrence relation的时候不同,要首先假设a是LIS中的一员,for all the i, recursively solve the right and left side of a[i], find the longest one. 第一眼貌似挺好写的,可是问题是怎么track the largest element in the left part LIS and the smallest element in the right part LIS.[/i] |