Change Making Problem - Dynamic Programming

  Рет қаралды 66,356

CSBreakdown

CSBreakdown

Күн бұрын

Пікірлер: 34
8 жыл бұрын
Something that bothers me about every single video and book about computer science, is the tendency to use very short and difficult to interpret variable names. It would have been much easier if for example c[p] was named numCoins[targetSum] or something along those lines. Some of these single-letter names always end up being completely arbitrary and the best you can do is try to remember what they mean when the slide is changed (or you flip the page in your book).
@partyhatman
@partyhatman 8 жыл бұрын
I agree 100%. Naming conventions can make this soooo much easier to understand and learn.
@SinCityGT3
@SinCityGT3 7 жыл бұрын
Agreed. Even when they explain the mathematics it's hard to follow... S` = S {Dk}... what?
@irvinge4641
@irvinge4641 6 жыл бұрын
one thing that confused me is in the beginning he introduced S as optimal solution and S', but later on he used c[p]
@kar2k
@kar2k 5 жыл бұрын
YES!!!
@revathik9225
@revathik9225 7 жыл бұрын
I read several tutorials and watched several videos but this is the only video from which I could understand coin change solution using DP. You're the best.
@AhmedToulan
@AhmedToulan 8 жыл бұрын
Saying the numbers without showing the equations you're using can be pretty confusing. Otherwise, great video.
@dryoldcrabman6890
@dryoldcrabman6890 5 жыл бұрын
This is the first explanation of over actually understand. You rock man! Thanks you.
@nfanni97
@nfanni97 6 жыл бұрын
Thank you so much, this helped me write the code in less than an hour (while understanding what I was doing). Exactly what I was looking for, a clear, simple explanation without he actual code so i have to do something myself :D
@anumali5907
@anumali5907 8 жыл бұрын
Great work!!!Loved the explanation and the demonstration :D
@samiulhoque3769
@samiulhoque3769 8 жыл бұрын
Thanks alot foe the great video ^_^ Please add the equation in the video for each iteration, it is kind of confusing without it.
@irvinge4641
@irvinge4641 6 жыл бұрын
Also when you say "last coin" used in the s[p] array, its the di that corresponds to the minimum chosen in c[p] right?
@mysteriousbillionaire7349
@mysteriousbillionaire7349 7 жыл бұрын
at p= 10 cents how is the choice made between 6 coins and 2 coins, are both the function run and compared?
@skinpa
@skinpa 8 жыл бұрын
Shorting before 3:17 you say that replacing S' with X would contradict S being optimal. Can you elaborate on that?
@opiumgrowing682
@opiumgrowing682 7 жыл бұрын
Suppose by way of contradiction that S' is not optimal and that the optimal solution is X (X uses less coins to make n-d_k cents). Then we could add d_k cents to X (say Y = X+{d_k}) and Y uses less coins to make n cents. But Y can't use less coins than S from the assumption that S is optimal. That is the contradiction.
@jebediah2345
@jebediah2345 8 жыл бұрын
Thank you very much, this was very helpful.
@xMrJanuaryx
@xMrJanuaryx 6 жыл бұрын
Are you suggesting we use recursion? For instance you say c[p] = (0, if p = 0 or min(c[p-di]+1) if p > 0). So is min some undefined method that your referring to? Is this a typical form of describing a recursive solution to a problem that you might find in a textbook or something? I do not think that I understand the vernacular. Also confused because sometimes di seems to be a position in an array and other times di seems to be an actual coin value??
@DeaconOfTheDank
@DeaconOfTheDank 8 жыл бұрын
Great explanation. Dynamic programming problems are always a little tricky for me so your video goes a long way for me. Keep 'em coming!
@johnhammer8668
@johnhammer8668 7 жыл бұрын
all other videos on KZbin start from drawing the tables without proving the optimal substructure. thanks so much for the format (first proof then recurrence , then explanation) this is exactly how intuition is taught.
@KanagaveluSugumar
@KanagaveluSugumar 8 жыл бұрын
Thank you! so much for explanation of why greedy algorithm fails here. :)
@arianphilips5777
@arianphilips5777 4 жыл бұрын
new suscriber
@duaa9649
@duaa9649 Жыл бұрын
That was super helpful!
@osrax
@osrax 5 жыл бұрын
excellent video!
@usamakhalid1990
@usamakhalid1990 7 жыл бұрын
Whats di?
@mysteriousbillionaire7349
@mysteriousbillionaire7349 7 жыл бұрын
highest available coin that is >= to P
@irvinge4641
@irvinge4641 6 жыл бұрын
subscribed bruh
@trackbit9hopugneru660
@trackbit9hopugneru660 8 жыл бұрын
A nickle is at least 5 € Cents now in the Netherlands it will be for sum reason..
@irvinge4641
@irvinge4641 6 жыл бұрын
this would be considered a bottom up implementation right?
@irvinge4641
@irvinge4641 6 жыл бұрын
c[p] is the same as optimal number of coins right?
@arianphilips5777
@arianphilips5777 4 жыл бұрын
magnificent explanation
@ONeillCode
@ONeillCode 7 жыл бұрын
Nice explanation!
@vishwanathbhat1382
@vishwanathbhat1382 6 жыл бұрын
Very confusing :|
@michaelliu825
@michaelliu825 7 жыл бұрын
Awesome explanation!!!!
Maximum Contiguous Subsequence - Dynamic Programming
6:47
CSBreakdown
Рет қаралды 25 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
How Strong is Tin Foil? 💪
00:26
Preston
Рет қаралды 125 МЛН
Incredible: Teacher builds airplane to teach kids behavior! #shorts
00:32
Fabiosa Stories
Рет қаралды 10 МЛН
Поветкин заставил себя уважать!
01:00
МИНУС БАЛЛ
Рет қаралды 6 МЛН
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15
The Change Making Problem - Fewest Coins To Make Change Dynamic Programming
23:12
Principle of Optimality - Dynamic Programming
9:26
CSBreakdown
Рет қаралды 208 М.
Oh, wait, actually the best Wordle opener is not “crane”…
10:53
Rod Cutting - Dynamic Programming
15:22
CSBreakdown
Рет қаралды 153 М.
0/1 Knapsack problem | Dynamic Programming
13:29
WilliamFiset
Рет қаралды 155 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
COIN ROW PROBLEM
34:03
Pavan Mahendrakar
Рет қаралды 2 М.
What's The Longest Word You Can Write With Seven-Segment Displays?
8:56
4 Steps to Solve Any Dynamic Programming (DP) Problem
0:57
Greg Hogg
Рет қаралды 379 М.
How Strong is Tin Foil? 💪
00:26
Preston
Рет қаралды 125 МЛН