# Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pa:laboratoare:laborator-04 [2018/04/02 14:03]
darius.neatu
pa:laboratoare:laborator-04 [2019/03/20 10:05] (current)
gabriel.bercaru [Exemple clasice]
Line 163: Line 163:
* $dp[i][i+1] = d_{i-1} d_{i} d_{i+1}$     * $dp[i][i+1] = d_{i-1} d_{i} d_{i+1}$
* Daca avem doua matrice, putem doar sa le inmultim. Nu are sens sa folosim paranteze.       * Daca avem doua matrice, putem doar sa le inmultim. Nu are sens sa folosim paranteze.
-      * Daca inmultim 2 matrice de dimensiuni $d_{i-1} * d_{i}$ si $d_{i} * d_{i + 1}$, avem costul $d_{i-1} d_{i} d_{i-1}$+      * Daca inmultim 2 matrice de dimensiuni $d_{i-1} * d_{i}$ si $d_{i} * d_{i + 1}$, avem costul $d_{i-1} d_{i} d_{i+1}$
* **Cazul general**: $dp[i][j] = min(dp[i][k] + dp[k+1][j] + d_{i-1} d_{k} d_{j})$, unde $k = i : j - 1$   * **Cazul general**: $dp[i][j] = min(dp[i][k] + dp[k+1][j] + d_{i-1} d_{k} d_{j})$, unde $k = i : j - 1$
* daca avem de efectuat sirul de inmultiri $M_i ... M_j$, atunci putem pune paranteze oriunde si sa facem inmultirile astfel $(M_i ... M_k) (M_{k+1} ... M_{j})$     * daca avem de efectuat sirul de inmultiri $M_i ... M_j$, atunci putem pune paranteze oriunde si sa facem inmultirile astfel $(M_i ... M_k) (M_{k+1} ... M_{j})$
pa/laboratoare/laborator-04.txt · Last modified: 2019/03/20 10:05 by gabriel.bercaru