看了WIKI http://en.wikipedia.org/wiki/Longest_increasing_subsequence
但是binary search那段还是不明白,有哪位大侠明白的讲一下,多谢!
L = 0
for i = 1, 2, ... n:
binary search for the largest positive j ≤ L
such that X[M[j]] < X[i] (or set j = 0 if no such value exists)
P[i] = M[j]
if j == L or X[i] < X[M[j+1]]:
M[j+1] = i
L = max(L, j+1)