20. Dynamic Programming II: Text Justification, Blackjack
20. Dynamic Programming II: Text Justification, Blackjack
MIT 6.006 Introduction to Algorithms, Fall 2011
View the complete course: http://ocw.mit.edu/6-006F11
Instructor: Erik Demaine
License: Creative Commons BY-NC-SA
More information at http://ocw.mit.edu/terms
More courses at http://ocw.mit.edu
Did any one has taken notes from these lectures?
Can somebody explain, Why was 1 added to indegree(v)?
At one point he says it’s for memorization(12:55) and then at another point he says it’s account for 0 edges(10:25).
Great lecture! Thanks Erik and MIT.
OMG, basic strategy is to hit soft 18 vs 9 or T. Victor erred on both hands. Casing the entire deck makes much more for baccarat, not blackjack. And in reality you’d double, split, and change the number of hands. It gets more interesting if you have partial omniscient information, say suborderings of cards.
35:16 – Parent Pointers
Professor: " This talk will be about DPs and BJ with some text justification."
Interviewer: "What about BJs?"
Professor: "About BJ, (as I said at 49:15) if I’ve already busted, I can’t hit again"
Interviewer: "But what is the general starting point?"
Professor: "Well the base case for a 2×3^2 problem is 18 but as I said at 49:18 : maybe I take another hit , maybe I take another hit again, maybe I take another hit again. At some point I go over 21 and then you have got to stop the for loop."
Interviewer: "What exactly are we talking about? Weed? Young women?"
Professor: "Absolutely not. THIS IS COMPUTER SCIENCE! (/SPARTA) =D"
Ah, Counting cards.
Why word’s strategy is not better
I have a hard time finding how "page width" is actually computed in badness(i, j).
00:00 review of last lecture
05:53 five "easy" steps to DP
08:40 step 1: define sub-problems
09:51 step 2: guess (part of solution)
11:06 step 3: relate sub-problems
13:15 step 4: recurse and memoize or build DP table bottom-up
15:28 step 5: solve original problem
17:05 text justification
35:12 parent pointers
5 easy steps to DP: 2 in the pink, 1 in the stink.
Okay, now my question is what to do with the infinite loop on Erik’s T-shirt!!
I dont get it…sorry..
Yeah unfortunately this was really confusing. No code examples, no clarity, just random babble that left me utterly confused.
اهل مدرسه را به اهالی مدرسه پاس می دهند ،مگر خودشان اینرا نمی خواهند
واهل تحقیق همدیگر را می شناسند
hearing "DP" and "BJ" in a video made me wonder if I was watching the wrong kind of video :V
Bolo siyavar ram chandra ki jai!
dynamic programming in 5 easy steps that silicon valley don’t want you to know!
I wonder how you’d handle the value of Ace in the blackjack algorithm
20:48 "why cubed? who knows". I wonder if this is to penalize big badness in an exaggerated way compared to small badness (so that, say, a badness of 2 is not twice as bad, but 8 times as bad as a badness of one). It seems to me that the effect of this is to favour justifications with a large number of lines that are just a little bit bad, over justifications with a few very bad lines. It sort of reminds me of the different error/objective functions in machine learning, if you know what I mean. The exponent (the 3) could be regarded as a (meta?) parameter of sorts, and it might even make sense to apply machine learning to text justification, where the optimal value for this exponent is learned from a large number of texts that were manually justified.
Actually the "shortest paths in some DAG" perspective for dynamic programming could be a very slippery slope
at 49:00 , why is the range from(i+4,n)? what does 4 in i+4 signify?
Jesus loves you
Believe in him and repent !
The "latest" Word as of 2013 does not have smart line justification. Now it’s 2019 Word still does not have it. From time to time I have to delete/change a word to make the next line not too ugly…
But how do we add memoization to the recursive text justification algorithm?
For an academic video, there are a lot of n-words.
An algorithmic problem I was trying to solve required Dynamic Programming (Kickstart 2020 Plates) as the optimal solution. Scratched my head so much looking at the solution and time complexity thinking : "isnt this just brute force?".
Such lectures are never free people pls young people if u are plannig to go for any university then also u have to pay like I am paying
26:22 … No this is what makes dynamic programming .. well, dynamic programming!
The "5 Steps" are pedagogical gold
16:46 — Text justification
38:50 — Blackjack
Do MIT students ever ask questions?
Parent Pointers begins at 35:17
can’t belive he said "the n-word" so many times and got away with it
Cubed..i wonder if its rule of thirds?
This doesn’t really help much. How would you define badness?
At 33:23 shouldn’t the run time actually be O(n(n+1)/2) instead of O(n^2)? If you think about it as starting with i = n – 1 and working backward to i=0, then the for loop iterations in the min statement will look like this:
range(n, n+1) – 1 iteration
range(n – 1, n+1) – 2 iterations
range(n – 2, n+1) – 3 iterations
range(0, n+1) – n iterations
The runtime should just be the sum of integers 1 to n, which by induction is n(n+1)/2 which is significantly faster then n^2
49:48 to 50:12
Can someone explains me why j equal to i + 4 + #hits +#dealer-hits? Thank you
this guy is brilliant !!
Those 5 guys who until this moment gave their dislikes I believe they are taking courses at high school. Btw, this professor is amazing! He motivated me much more that I usually used to be doing.
Excellent. for me watching these lectures is like watching moves : relaxing but very useful and entertaining
for the text justification, i cant see where the memoization happens. To me, DP(i) is a recurrence function that elaborates the subproblems and min(dp for j in range(…)] is just gonna calculate all the possible new lines. I guess we are to maintain a memo table in the course of bottom up actions which are automated at the end of recurrence? is the job of the memo table to record the dp of i onwards that might have repeated in the course of elaboration？
Good old chalk talk
11 minutes in ..any questions? No.
how is this different from original word greedy approach? this is the greedy approach. just take as much as you can on one line and recurse
Why cubed? Who knows.
It makes sense to cube the result to obtain the badness: you preserve the sign, so you can know if your line is too large or too small…
I don’t understand the text justification problem. Someone pls helps me.
40:28 that Hoodie Shirt meaning MIT 🙂 for who curious