Изменения

Перейти к: навигация, поиск

Черновик:Перемножение матриц

568 байт убрано, 06:17, 9 ноября 2011
Нет описания правки
Pseudocode Псевдокод (without memoizationбез меморизации):
<pre>
// Matrix Ai has dimension p[i-1] x p[i] for i = 1..n
</pre>
*Note Замечания : The first index for p is 0 and the first index for m and s is 1Another solution is to anticipate which costs we will need and precompute them. It works like this:* For each Индексирование массива ''k'' from 2 to ''np''начинается с нуля, the number of matrices:** Compute the minimum costs of each subsequence of length а у массивов ''km'', using the costs already computed.When weи 're done, we have the minimum cost for the full sequence. Although it also requires O('s'n''<sup>3</sup>) time, this approach has the practical advantages that it requires no recursion, no testing if a value has already been computed, and we can save space by throwing away some of the subresults that are no longer needed. This is bottom-up dynamic programming: a second way by which this problem can be solvedс единицы.
==Ссылки==
Анонимный участник

Навигация