R5. Dynamic Programming

  Рет қаралды 111,529

MIT OpenCourseWare

MIT OpenCourseWare

Күн бұрын

Пікірлер: 72
@AnitShrestha
@AnitShrestha 5 жыл бұрын
Simple. And makes sense. I have been trying to understand dynamic programming for a while, literally. Thank you Ling, and MIT for making it open. Furthermore, I would love to watch the advance level on the topic by him.
@stormanning1163
@stormanning1163 7 жыл бұрын
To achieve O(n.lg(n)) in the block problem, perhaps given the set of blocks {r1,...rn} we begin by creating two balanced BSTs, one that uses the width as the tree property (what determines if a value becomes a left or right child), and one that uses the height as the tree property. It takes O(2n.log(n)) to build these tree's initially. Now as we add blocks to our stack. Say we just added the block ri with Width Wi, and height Hi, we can first look at our heightBST and find the first block with Hj less than Hi, and clip the entire sub tree, because these values are no longer valid, removing them from the tree, and for each block we remove from the tree, we can also remove them from the WidthBST by searching for them in lg(n) time and removing them, this will take k.log(n) time where k is the number of elements we had to remove. Now we do the same for the WidthBST finding the first block that's Wj < Wi, and we clip this sub tree and removing elements in the height tree similar to as before... Overall we get O(2n.log(n) for the initial tree set up, and then every time we choose a block O(k.log(n)) where k is the number of lookups required for both deletions from the tree's Either way k is bounded by n, giving us O(n.lg(n).
@jamesqiu6715
@jamesqiu6715 8 жыл бұрын
clear, precise, good hand writing ... wish to see a bit more smiling faces from Ling
@akshaymathur2225
@akshaymathur2225 7 жыл бұрын
Me too
@paxdriver
@paxdriver 6 жыл бұрын
Lol prof has that "I'd rather be coding" look on his face
@joeybing3774
@joeybing3774 6 жыл бұрын
lmao
@benisrood
@benisrood 10 ай бұрын
Working on his own research, yes I am sure he would! Especially when the students are so slow to give answers...
@paxdriver
@paxdriver 9 ай бұрын
@@benisrood lol it wasn't a criticism, just having some fun with it to boost the video with engagement.
@Squirrelschaser
@Squirrelschaser 5 жыл бұрын
For the stacking box problem, if there were only two dimensions then an O(nlogn) solution is possible. Sorting the boxes by one dimension reduces the problem to LIS (longest increasing subsequence) in the other diimension, which can be solved in nlogn.
@mattf9076
@mattf9076 11 ай бұрын
@8:30 I am not sure why the subproblems are defined as min(Mc(N-si)+1)?
@TooCoolForBZ
@TooCoolForBZ 3 жыл бұрын
How does log(n) represent the size of n input? that part was too quick. @14:00
@donotreportmebro
@donotreportmebro Жыл бұрын
I wonder if you eventually figured this out? Just watching this now
@akurmustafa_
@akurmustafa_ 9 ай бұрын
@@donotreportmebroI couldn't get how log(n) comes in the play. However, the problem description is in terms of M (distinct coins). N is just a arbitrary argument for the problem. Hence O(M) complexity would have solve the NP-completeness problem. At least this is my understanding
@scotfsh5014
@scotfsh5014 2 ай бұрын
it's the concept of pseudo polynomial, use of binary representation
@mrleolink
@mrleolink 6 жыл бұрын
for the compatible set problems, in order to achieve nlogn, I think we can use kd-tree
@mech_builder7998
@mech_builder7998 7 жыл бұрын
Universal Hashing and Perfect Hashing starting @ 34:27
@xihu4067
@xihu4067 4 жыл бұрын
13:46 could anyone explain why is it logN? I'm really confused here...
@IkerLissarrague
@IkerLissarrague 4 жыл бұрын
the size of N (the number of bits) is given by logN and computational complexity is formally measured in terms of input size. therefore knapsack's complexity in terms of input size is: O(2^(logN)*m) stackoverflow.com/questions/19647658/what-is-pseudopolynomial-time-how-does-it-differ-from-polynomial-time
@xihu4067
@xihu4067 4 жыл бұрын
@@IkerLissarrague Ah it makes sense, thank you! :D
@vahanpoghosyan1581
@vahanpoghosyan1581 2 жыл бұрын
@@xihu4067 seems like the comment is gone. What was the answer?
@дантээлрик
@дантээлрик 3 жыл бұрын
Ling Ren is awesome. Thanks for grilling them¡
@breezysaint9539
@breezysaint9539 8 жыл бұрын
clear and concise, nicely done
@KaramAbuGhalieh
@KaramAbuGhalieh 7 жыл бұрын
shouldn't we start from the end point? for the robot example
@sumofentropy
@sumofentropy 5 жыл бұрын
Both approaches are symmetric so it doesn't make a difference which end point you choose. (In this example the only allowed directions were (up,right) so it doesn't make sense to start from the endpoint as you will have nowhere to go.)
@grim4a275
@grim4a275 5 жыл бұрын
and if both left as well as right turns are permitted, how are there just two ways to reach the diagonally first node after the starting point? there can be many more possible ways. like go up by 2 steps, take a right and go 1 step, take right and go 1 step more.
@alimustafa2682
@alimustafa2682 7 жыл бұрын
30/52 minutes waiting for answers
@taureandials1246
@taureandials1246 6 жыл бұрын
Wen Chu how's yours ?
@HippoShemp
@HippoShemp 6 жыл бұрын
is this question clear?
@Bridgelessalex
@Bridgelessalex 4 жыл бұрын
This is a recitation rather than then actual course.
@NytronX
@NytronX 6 жыл бұрын
Difficulty level: ASIAN.
@zsoltbr
@zsoltbr 3 жыл бұрын
The lack of throwing freesbees clearly shows in the activity of the audience.
@shaoin3295
@shaoin3295 5 жыл бұрын
doesn't even explain the problem! are we supposed to read his mind?
@chrislam1341
@chrislam1341 5 жыл бұрын
I doubt if O(m*n) is the solution for the grid problem.. Suppose we are going to m,n = (2, 2) , from x, y = (0, 0). Up (U) or Right (R) are options: P1: UURR P2: URUR P3: URRU P4: RURU P5: RRUU # of distinct path: 5 != 2*2 = m*n ..?
@popferi9573
@popferi9573 4 жыл бұрын
First of all time complexity is not the same as # of distinct paths from 0,0 to 2, 2. Second of all, you have a 3x3 matrix which has 6 distinct paths, you are missing the P6: RUUR.
@cvxcfv
@cvxcfv 3 жыл бұрын
O(m*n) is the Big O notation // time complexity not the solution...just shows how much you understand what's actually going on lol
@benisrood
@benisrood 10 ай бұрын
What the others said, plus Ling clearly said that the answer was m+n. In your example case, 3+3 = 6, which is correct (when you include the missing case RUUR)
@uniswang
@uniswang 7 жыл бұрын
what's the difference between these R videos and the normal lecture?
@ranggagarmastewira3344
@ranggagarmastewira3344 7 жыл бұрын
R = recitation, and is taught by the professors' assistants
@user-qc9rq3vb2z
@user-qc9rq3vb2z 5 жыл бұрын
@@ranggagarmastewira3344 This guy is so good, I didn't even think he was the assistant.
@yushpi
@yushpi 5 жыл бұрын
@@user-qc9rq3vb2z you have to be that good to be even an assistant at MIT
@useless0ful
@useless0ful 6 жыл бұрын
Guys, so sorry, but i didn't understand how runtime is (N*m) for the minimum number of coins problem. Can someone please explain?
@vigneshwarp3462
@vigneshwarp3462 6 жыл бұрын
O(N*m) - m => Count of different denominations {S1, S2... Sm} Here In the Recursive equation he outlined, you can see its a loop running for Si, (i runs from 1 to m) means, he is computing solutions for all possible denominations and get the min out of it. So, its N*m work. Hope that helps!
@useless0ful
@useless0ful 6 жыл бұрын
Vigneshwar P Thankyou so much!
@x0cx102
@x0cx102 4 жыл бұрын
46:11 second line that should be an inequality
@Anubis10110
@Anubis10110 4 жыл бұрын
I guess Mr. Ling doesn't like What he is Doing !!
@bronsonschnitzel7493
@bronsonschnitzel7493 4 жыл бұрын
good god I feel bad for whoever took this course from this kid. He gives a portion of the problem statement and waits around for 30 minutes waiting for answers to his simple problem.
@cvxcfv
@cvxcfv 3 жыл бұрын
This is a recitation not a lecture...fool
@techfornoobs4241
@techfornoobs4241 6 жыл бұрын
this guy is hella smart
@franciszekwieczorek5292
@franciszekwieczorek5292 3 жыл бұрын
I agree, but simultaneously is probably the worst teacher
@bablobko
@bablobko 3 жыл бұрын
Ling Ren for Presidency.
@akshaymathur2225
@akshaymathur2225 7 жыл бұрын
@ 16: 00 I couldn't understand the line "One is East West, One is North South" ... ?? I understood about that l ,w are to be compared against l1 and w1 and not w1 and l1 respectively. but how does that english sentence mean this mathematical expression.
@SahilThakur26
@SahilThakur26 4 жыл бұрын
that digression is a bit hard to understand
@sextolife
@sextolife 7 жыл бұрын
Hello sir for DP there is no exact formula to find the answer,
@qijinliu4024
@qijinliu4024 6 жыл бұрын
Wonderful speech bro :D
@akshaymathur2225
@akshaymathur2225 7 жыл бұрын
Very neat.
@vishnukl
@vishnukl 8 жыл бұрын
miss Victor Costan
@AMANKUMAR-oh1zt
@AMANKUMAR-oh1zt 3 жыл бұрын
Same here :-(
@grim4a275
@grim4a275 5 жыл бұрын
if the robot can go either up or right only, wont there be just one possible path?? rest all would require a left turn .....
@chaoschao9432
@chaoschao9432 8 жыл бұрын
clear, nice handwriting, thanks
@codyheiner3636
@codyheiner3636 3 жыл бұрын
It pains me how dead this class is. But I like the lecturer.
@krokenstiv8777
@krokenstiv8777 3 жыл бұрын
this guy looks like a character from a cartoon
@lxkp3233
@lxkp3233 5 жыл бұрын
very good explanation
@linuxmaster2327
@linuxmaster2327 4 жыл бұрын
Nice
@x0cx102
@x0cx102 4 жыл бұрын
"the third option, of course, we can just call it a day" haaha! considering that was at the 33 minute mark, clearly didn't happen
@ytg6663
@ytg6663 3 жыл бұрын
?
@deathbombs
@deathbombs 5 жыл бұрын
video says DP but at 35:00 he goes into hashing lol
@dandong8329
@dandong8329 5 жыл бұрын
maybe a little more emotion?
@TheMasterfulcreator
@TheMasterfulcreator 5 жыл бұрын
it's a computer science lecture...
@arunm619
@arunm619 5 жыл бұрын
Not a movie...😂
@cvxcfv
@cvxcfv 3 жыл бұрын
@@TheMasterfulcreator It's not even a lecture, it's a recitation
@TheMasterfulcreator
@TheMasterfulcreator 3 жыл бұрын
@@cvxcfv not wrong.
9. Augmentation: Range Trees
1:24:34
MIT OpenCourseWare
Рет қаралды 62 М.
12. Greedy Algorithms: Minimum Spanning Tree
1:22:10
MIT OpenCourseWare
Рет қаралды 229 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 82 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 25 МЛН
The 0/1 Knapsack Problem (Demystifying Dynamic Programming)
20:30
Back To Back SWE
Рет қаралды 209 М.
2023 MIT Integration Bee - Finals
28:09
MIT Integration Bee
Рет қаралды 2,1 МЛН
8. Randomization: Universal & Perfect Hashing
1:21:51
MIT OpenCourseWare
Рет қаралды 90 М.
Dynamic Programming: Optimal Binary Search Trees Part 1
7:59
Chris Bourke
Рет қаралды 18 М.
5 Simple Steps for Solving Dynamic Programming Problems
21:27
Reducible
Рет қаралды 1,1 МЛН
Necessity of complex numbers
7:39
MIT OpenCourseWare
Рет қаралды 2,8 МЛН
26. Chernobyl - How It Happened
54:24
MIT OpenCourseWare
Рет қаралды 2,9 МЛН
16. Complexity: P, NP, NP-completeness, Reductions
1:25:25
MIT OpenCourseWare
Рет қаралды 414 М.
6. Randomization: Matrix Multiply, Quicksort
1:21:52
MIT OpenCourseWare
Рет қаралды 62 М.
Introduction to Poker Theory
30:49
MIT OpenCourseWare
Рет қаралды 1,4 МЛН