Pagini recente » Diferente pentru problema/ikebana intre reviziile 1 si 2 | Diferente pentru problema/vladut intre reviziile 7 si 6 | Diferente pentru utilizator/ericqw intre reviziile 10 si 9 | Diferente pentru problema/costuri intre reviziile 7 si 6 | Diferente pentru blog/square-root-trick intre reviziile 54 si 53
Nu exista diferente intre titluri.
Diferente intre continut:
==
This algorithm takes $O(nm)$ time and only $O(n)$ space, since to compute a row you just need the previous row.
If you must return the actual sub sequence this doesn't work. You can keep an array of parent pointers, so that for each state $(i, j)$ you know the previous state in the solution. The longest sub sequence corresponds to a path from $(n-1, m-1)$ to $(0, 0)$ on the parent matrix. This solution takes $O(nm)$ space.
If you must return the actual sub sequence this doesn't work. You can keep an array of parent pointers, so that for each state $(i, j)$ you know the previous state in the solution. The longest sub sequence corresponds to a path from $(n-1, m-1)$ to $(0, 0)$ on the parent matrix. This solution takes $O(nm)$ space.
Let's try to use less memory. We solve the problem once and save every kth row from the $best$ matrix and from the $parent$ matrix.
!<{margin-right: 20px; auto;display:block;}blog/square-root-trick?image02.png 90%!
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.