algorithm - longest common subsequence with linear memory usage -
i'm trying find algorithm uses linear space of memory for:
given 2 strings x , y on arbitrary alphabet, determine longest common sub sequence.
note when you're calculating next row of table in dynamic programming solution solve lcs problem, need previous row , current row. can modify dynamic programming solution keep track of previous row , current row instead of m x n table. every time reach end of current row, set previous row current row, , start beginning of row again. m times m number of rows in table. use space linear in number of columns.
Comments
Post a Comment