Algorithms: Memoization and Dynamic Programming

Algorithms: Memoization and Dynamic Programming

HackerRank

7 лет назад

963,548 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

rydmerlin
rydmerlin - 05.05.2023 15:47

What is the purpose of your if test for memo[n]. You left out the == 0 .Don’t you only want to compute it if it’s not cached and return the one you have cached.

Ответить
Damian Estey
Damian Estey - 01.03.2023 13:54

Is this how you play minesweeper?

Ответить
Mr. Erik  Chun
Mr. Erik Chun - 09.02.2023 21:50

Garbage explaining for someone who’s never seen this before.

Ответить
Country Mac
Country Mac - 08.02.2023 03:24

ATTENTION! Her code is WRONG. HERE is what correct memoization looks like.


function fibonacci(n, memo)
if memo[n] is not None
return memo[n]
if n <= 1
f = 1
else
f = fibonacci(n-1, memo) + fibonacci(n-2, memo)
memo[n] = f
return f

Ответить
Irwansyah
Irwansyah - 30.12.2022 12:38

Amazing, very good explanation, makes me understand the concept of memoization, thanks!

Ответить
Kian Kyars
Kian Kyars - 30.11.2022 22:17

how is the sapce compelxity for recurive fibonnaci O(N) !??!?!

Ответить
Tio Irawan
Tio Irawan - 06.11.2022 14:07

can anyone show me the working code of the path counting porblem using DP?

Ответить
John C
John C - 21.10.2022 15:50

I like the "traditional" approach at 10 mins.
That is actually quite interesting and never thought about that

Ответить
Peter
Peter - 01.10.2022 00:06

In the Fibonacci example why do you do “if else memo[n]” rather than “if else !(memo[n])”? Aren’t you checking if there is a value and if there isn’t (ie it is NULL) then calculate it?

Ответить
U Know
U Know - 07.08.2022 04:44

Thanks! Very clear explanation.

Ответить
Brian Tep
Brian Tep - 21.07.2022 19:33

how can Memoization help if your input is > 1000 ...

Ответить
Khalifa castaway
Khalifa castaway - 28.06.2022 22:57

Awesome video in illustrating difficult concepts

Ответить
Bhupendra Pandey
Bhupendra Pandey - 14.06.2022 21:36

Thanks for this video.

Ответить
Mickey Kutti
Mickey Kutti - 11.06.2022 10:33

What do the words associative arrays , lookup table,cache hit/miss ratio have in common with memoization?

Ответить
Blake Edwards
Blake Edwards - 28.04.2022 08:56

Great explanation. Thank you!

Ответить
Stan St
Stan St - 07.02.2022 18:14

Thanks for the interesting video. Very concise and clear explanation of dynamic programming concept.

Ответить
Abdoul Barry
Abdoul Barry - 02.02.2022 04:19

Best videos eveeerrr!! Matrix problems I just use i and j.

Ответить
Metao Cloud Studio
Metao Cloud Studio - 29.01.2022 05:06

Forgotten to write:
if (row > max || col > max) return 0;
otherwise row and col keep increasing and will buffer overflow

Ответить
Vaibhav Sharma
Vaibhav Sharma - 05.12.2021 08:54

Point to be noted- We will never reach sqaures with 7,4,1,1 in first column, as we can only go right but not left.

Ответить
swapnik1000
swapnik1000 - 02.12.2021 00:35

Wouldn't this break if there were enough blocks requiring the path to go up or left?

Ответить
swapnik1000
swapnik1000 - 01.12.2021 20:16

Amazing explanation!

Ответить
Jere Lotvonen
Jere Lotvonen - 22.11.2021 20:55

I once stumbled onto the misconseption you mentioned when using y as rows and x as columns and now I just figured it out why it happened then 😅. When we use the grid representation it would be good to indicate that arrows pointing the directions mean that its the way where row numbers are increasing and not neccessarily the way that rows are aligned I’m kind of dumb but if anyone else had this problem that might be the answer

Ответить
extremelyhappysimmer
extremelyhappysimmer - 09.11.2021 22:13

I deadass thought you just pronounced 'memorization' incorrectly and was very confused for a sec.

Ответить
Carolina Alba Marugan Rubio
Carolina Alba Marugan Rubio - 16.10.2021 00:20

You are such an amazing teacher!!

Ответить
Jiali Liang
Jiali Liang - 14.10.2021 20:08

This is so good! She concises my 2.5 hrs lecture into 11 mins.

Ответить
Loukas Robotics
Loukas Robotics - 25.08.2021 01:22

Honestly you cant learn dynamic programming

Ответить
Murat
Murat - 21.08.2021 02:53

Нормально перевели, "карьера программиста"...

Ответить
94mathdude
94mathdude - 18.08.2021 09:44

Using the explicit formula for fibonacci numbers, you can implement it in O(log n) time.

Ответить
CyberMew
CyberMew - 15.07.2021 22:11

So what was the last part going from bottom-up about? Is it just running the example or showing us a different way to do code it?

Ответить
SEE:MY:SOUL
SEE:MY:SOUL - 02.06.2021 13:57

Best as always, Gayle Laakmann.

Ответить
Aleksander Klepov
Aleksander Klepov - 11.05.2021 13:52

kap'epa npogpammucta

Ответить
DevSkills
DevSkills - 30.03.2021 19:26

space complexity of recursive solution for fibonacci series very well explained.

Ответить
Technology Professor
Technology Professor - 29.03.2021 10:37

Good explanation of memoization !!!

Ответить
E. G.
E. G. - 16.03.2021 23:24

Would have been nice to see the explanation of adding in the memo array

Ответить
dzuyhue
dzuyhue - 24.02.2021 23:20

Thank you for making it so easy to understand !

Ответить
Aniruddha Shevle
Aniruddha Shevle - 24.02.2021 11:24

Thank you so much, you really enlightened my way!

Ответить
Bilal Youtubber
Bilal Youtubber - 02.02.2021 21:50

Grt online teacher

Ответить
Coding With Ike
Coding With Ike - 30.01.2021 19:52

This video is extremely well done!

Ответить
Anubhav Bansal
Anubhav Bansal - 25.01.2021 08:10

Can the memo array be initialised with 0 and 1 and then the 2 ifs be removed?

Ответить
S M
S M - 19.01.2021 23:00

I know she is famous for her book, but she should not be doing these videos if she’s just going to phone it in. Get someone who can present clearly instead.

Ответить
angga
angga - 27.12.2020 18:36

Ok nanti aku cari di google ya, makasi ya lucifer ,

Ответить
angga
angga - 27.12.2020 18:35

Gak keliaaataaannnn bapaaakkk 🤣

Ответить
angga
angga - 27.12.2020 18:35

Gak keliatan ... ketutupan translate ...
Benerin 🤣ayok cepet !

Ответить
angga
angga - 27.12.2020 18:31

Dp = sub problems

Ответить