Pagini recente » Diferente pentru problema/permutare5 intre reviziile 3 si 4 | Diferente pentru problema/salsa intre reviziile 2 si 3 | Diferente pentru blog/algoritmiada-2010-runda-2 intre reviziile 12 si 1 | Autentificare | Diferente pentru blog/square-root-trick intre reviziile 25 si 26
Nu exista diferente intre titluri.
Diferente intre continut:
Let's see how can we 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 60%!
!<{margin-right: 20px; auto;display:block;}blog/square-root-trick?image02.png 80%!
We can start from the last saved row to n to compute the solution path from the n - 1 line to [n/k] * k line. And then go lower and lower to compute the part of the solution between the ik (i+1)k. Computing part of the path between row ik and row (i+1)k takes k * m space and k * m time. Computing the whole path takes n/k * (k * m) = nm time and km space, keeping every kth row in memory takes [n/k]m. again we minimize memory by using k = sqrt n
Caveats
Nu exista diferente intre securitate.
Topicul de forum nu a fost schimbat.