Longest Common Subsequence

后端 未结 3 558
长发绾君心
长发绾君心 2021-01-02 10:53

Consider 2 sequences X[1..m] and Y[1..n]. The memoization algorithm would compute the LCS in time O(m*n). Is there any better algorithm to find out LCS wrt time? I guess mem

3条回答
  •  时光取名叫无心
    2021-01-02 11:29

    yes we could create a better algorithm than Order O(m*n)--- i.e O(min(m,n)). to find a length..... just compare the diagonal elements.and whenever the increment is done suppose it occured in c[2,2] then increment all the value from c[2,2++] and c[2++,2] by 1.. and proceed till c[m,m]..(suppose m

提交回复
热议问题