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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -