Dynamic Programming | Set 1 (Solution using Memoization) | GeeksforGeeks

Поделиться
HTML-код
  • Опубликовано: 18 янв 2025

Комментарии • 44

  • @bonedoggle
    @bonedoggle 3 года назад +2

    Thank you so much for adding the captions, I have trouble processing spoken words sometimes and it goes in one ear and out the other, being able to read and hear the words at the same time helps it stay in my brain. You're a lifesaver and this is an excellent explanation.

  • @reetigarg7398
    @reetigarg7398 7 лет назад +19

    Thank you GFG! Dynamic Programming was never easy to understand before this.

  • @codesmart9044
    @codesmart9044 7 лет назад +1

    you just nailed it in just such a small video ..... totally rocked 1k thanks to you .....
    keep helping us....

  • @wadigzonDiazwong
    @wadigzonDiazwong 6 лет назад

    Excellent, thanks for putting this together.

  • @harshitanand8216
    @harshitanand8216 5 лет назад

    Greatly explained sir...love u sir

  • @sachinkun21
    @sachinkun21 5 лет назад

    import time
    # Memoization
    # initializing array
    with size atleast n+1 of fib you want to calculate
    list1= [0]*51
    def fib_memo(n):
    #Checking if value is present or not in List
    if list1[n]==0:
    # Base Case
    if n

  • @ManishSharma-xq9be
    @ManishSharma-xq9be 7 лет назад +4

    How we calculate time complexity in DP??

  • @lazizaakramova8602
    @lazizaakramova8602 Год назад

    Thank you very much!

  • @abhinavanand6761
    @abhinavanand6761 3 года назад

    Thank you @geeksforgeeks

  • @abhishekabraham4107
    @abhishekabraham4107 6 лет назад

    Sephiri! Thanks a lot! Cheers!

  • @jordanfranschman3406
    @jordanfranschman3406 5 месяцев назад

    This guy is the goat

  • @kartiksuman9814
    @kartiksuman9814 4 года назад

    Sir,I think here we need to use NULL instead of NIL

  • @saurabhvemuri5323
    @saurabhvemuri5323 6 лет назад +1

    First of all, thanks for the video. I have a doubt. Is "underscore" allowed in the beginning of a function name. What does this "underscore" at the beginning of function name mean ?

    • @thespicyspicey
      @thespicyspicey 3 года назад

      Nothing. It's exactly the same.

    • @apurbashakya2696
      @apurbashakya2696 3 года назад

      Idk about other programming languages but in dart we use to to declare private class

  • @rohitpandey3286
    @rohitpandey3286 6 лет назад +1

    Bro isn't mamoization a bottom up approach ?

  • @hocineabderrahmane3027
    @hocineabderrahmane3027 Год назад

    int fib(int number, int *dp){
    if(number < 2)
    return number;
    if(dp[number] != -1 )
    return dp[number];
    dp[number] = fib(number-1, dp) + fib(number-2,dp);
    return dp[number];
    }
    dp is an array the max number this function can count there fib number is 46 if you want to count bigger number you must change the data type int to long long int

  • @luciferdevil7198
    @luciferdevil7198 3 года назад

    if memoization is also done with help of recursion then why its time complexity drastically reduces ?? ......is it related to the storing of data......please explain

  • @skygautam
    @skygautam 6 лет назад

    I have a doubt why n is used to return answer I don't think we are storing any values in n

  • @surajchawla8916
    @surajchawla8916 6 лет назад +1

    after 46 it is not giving the right answer which datatype should i use??

    • @skygautam
      @skygautam 6 лет назад

      suraj chawla long would work

    • @siddharth__pandey
      @siddharth__pandey 6 лет назад

      even long long isn't working after 70 i guess

  • @amber.k
    @amber.k 4 года назад

    How come fibonacci using iteration solves this problem in o(n) without dynamic programming?

  • @ΑντρέαςΣωτηρίου-π8γ

    How can i use this in lis problem ?

  • @BeardedBong
    @BeardedBong 4 года назад

    u computed fib(n-1) while not considering fib(n-2) at the same time...wont those two parts be computed paralely?! can anyone explain?is it because the compiler executes a statement from left to right? is there any proof or reasoning?

    • @_haptic_shorts
      @_haptic_shorts 4 года назад

      Dm me on discord, I'll send you the chart, how fib function recursively call the next fib function, untill we heat the baseCase..
      Because i can't post the chart here :(

  • @karthikp7518
    @karthikp7518 5 лет назад

    even in memoisation we are performing the recursion then how the time complexity decreses

    • @anshulpandey6576
      @anshulpandey6576 5 лет назад

      Recursion is not the problem here . without memoisation we were running and calculating the same code again which was causing unnecessary calls and computation so complexity increased
      With memoisation we are storing the calculated values and we are not running the repeated code as we have already run that and stored the result
      This saves us from unnecessary calling of functions and reduces the time required to execute the code (time complexity)

  • @shriduttkothari
    @shriduttkothari 5 лет назад

    Audio is very low

  • @animeshsingh1307
    @animeshsingh1307 5 лет назад +1

    low volume

  • @senthilkumarsurya
    @senthilkumarsurya 4 года назад

    public class recurssion {
    public int arr[] = new int[8];
    public int fib_recurrive(int n)
    {
    if (n

  • @vishalbhola07
    @vishalbhola07 5 лет назад

    #include
    using namespace std;
    #define MAX 100
    # define NIL -1
    int lookup[MAX];
    void initialize()
    {
    for(int i=0;it;
    while(t--)
    {
    int a;
    cin>>a;
    cout

  • @sondidu
    @sondidu 2 года назад

    not all heroes wear capes

  • @pawandandotiya5798
    @pawandandotiya5798 5 лет назад

    what is base condition

    • @NKG_Creations
      @NKG_Creations 4 года назад

      fibonacci of zero is zero and fibonacci of one is one are the base conditions

  • @pranavkapoor6382
    @pranavkapoor6382 7 лет назад +1

    aww explanation sir :)

  • @NP-rh7ys
    @NP-rh7ys 6 лет назад

    AWESOME !!!!

  • @Karuska22ps
    @Karuska22ps 4 года назад

    i can't hear shiii

  • @jibonsaha2583
    @jibonsaha2583 6 лет назад

    102334155--done

  • @vinayjain1739
    @vinayjain1739 8 лет назад

    #include
    #define NIL -1
    #define MAX 100
    int look[MAX];
    void initial()
    {
    int i=0;
    for(i=0;i