All of Prof. Devadas lectures are just amazing. In particular, this is probably the best video I watched about DP.
One of the best DP lectures I have ever seen. Thanks to MIT open course ware and Prof. Srinivas Devadas
There is a tiny mistake in the formula at line 54:13. You can see it by setting i = 1, j = 2, and r = 1, which leads to the expression e[1, 0] + e[2, 2] + ..., where e[1, 0] is undefined. The correct formula can be found in CLRS, Section 15.5, on Optimal Binary Search Trees.
A counter-example to the greedy optimal BST algorithm using 3 nodes has w1 = 10, w2 = 11, w3 = 12. Cheers!
Srinivas and Erik you guys are the real Gs!
If you really want a counter example for 3 nodes, I suggest 1(w=20), 2(w=19), 3(w=18) Greedy would unbalance the tree in 1->2->3 giving a cost of 112 Optimal solution would give a balanced tree of 1<-2->3 that would cost 95
"If you go first your guaranteed to not lose". Man goes second and still won.
dp[i, j] = min(dp[i, j], e(i, r-1) + e(r+1, j) + wr * (depth+1)) also works if you add the depth every time you go down the recursion tree.
It was a very good lecture, everything simplified and quite interactive class.Thanks
I can see Eric Demaine sitting in the first row at (16:16) , he might be wondering, no subproblems and guessing, just directly the recurrence relation :D
In the last example I don't really understand why should we assume that the second player chooses the min of his options at the moment. Isn't they running a greedy?, it is said that they play optimally, so why don't we model them decision as another dp?
why we need to add all of the node (51:40) i though we need add wr (i<= r <= j)
1:20 You can skip some 1:04:04 dp mazimize
Erik Demaine 16:17
The third question should be MinMax problem.
First example question: the pseudocode shown at 22:33 only works with contiguous palindromes, am I wrong? Whereas the brain teasers at the start weren’t necessarily contiguous e.g. “rotator” out of “turboventilator” I do not see how the code can ever figure out “rotator” if you start it with L(0,end) Also I don’t see why nr. Of subproblems is n squared
what is wi's and pi's I didn't understand it yet.
Greedy al gore rhythm sounds like my kind of thing! I use greedy algorithms at my home in my own programs all the time
Thank You sir !! :)
@vishnusingh4118