3 func longestIncreasingSubsequence(srclen int, X func(int) int) []int {
7 M := make([]int, srclen+1) // M[j] == index into X such that X[M[j]] is the smallest X[k] where k<=i and an increasing subsequence with length j ends at X[k]
8 P := make([]int, srclen) // P[k] == index in X of predecessor of X[k] in longest increasing subsequence ending at X[k]
9 L := 0 // length of longest increasing subsequence found so far
13 mid := (lo + hi + 1) / 2
30 for k, i := M[L], len(ret)-1; i >= 0; k, i = P[k], i-1 {