Well, I hope someone can explain it to me. I am participating in the finals and I canβt understand anything.
The problem is dynamic programming; building an optimal binary search tree (OBST). I understand dynamic programming in general and the concepts of this problem in particular, but I do not understand the recursive form of this problem.
I understand that we are building optimal binary search trees for a growing subset of these nodes and storing the answers in the table as we move in order to avoid recalculation. I also get that when you are a root tree in a_ {k}, all successful nodes from a_ {1} through a_ {k-1} together with their corresponding fictitious unsuccessful nodes (that is, leaves of the tree) are in the left subtree, and then in the right subtree there is a_ {k + 1} through a_ {n}.
Here's a recursive form of an equation that I don't understand:
c (i, j) = min (i <k = j) {c (i, k-1) + c (k, j) + p (k) + w (i, k-1) + w (k + j)}
where w (i, j) = q (i) + the sum from i + 1 to j (q (l) + p (l)).
So, in c (i, j), from left to right, we have the cost of the left subtree + the cost of the right subtree + the probability of a successful search root + w (i, k-1) + w (k + k).
My confusion is how c (i, k-1) differs from w (i, k-1).
The text is the computer algorithms of Horowitz, Sahni and Rajasekeran, but I also read CLRS on OBST and searched the Internet, and nothing that I came across explains the difference between these parts of the equation well.