Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
A B C D E F G H I J K L M N O P ..
23 10 8 12 30 5 14 18 20 2 4 11 7 22 22 10 ..
D C Min
Cost
8x1 + 12x2 = 32
8x2 + 12x1 = 28
Cjj
Zero x
j-1 to j
j-1 to j
Root = D D
B
D
We already know this is best for C,D and stored its cost
Costs
Roots
Final cost
best[0,n-1] If r0 = best[0,n-1],
Left subtree root is
best[0,r0-1],
Right subtree root is
best[r0+1,n-1]
Root = E
E
B A C H
G
F
I
J
O(k2)
k2 = O(n3)
k =1