DP 1. Introduction to Dynamic Programming | Memoization | Tabulation | Space Optimization Techniques

Поділитися
Вставка
  • Опубліковано 5 жов 2024
  • Lecture Notes: takeuforward.o...
    Make sure to join our telegram group for discussions: linktr.ee/take...
    Pre-req for this Series: • Re 1. Introduction to ...
    Full Playlist: • Striver's Dynamic Prog...
    In this video, we have discussed what is memoization, what is tabulation, what is space optimisation with the classic Fibonacci problem. You might feel that this question has been done by you, but I will still urge you to watch this till the end because this is going to teach you a bunch of stuff.
    If you have not yet checked our SDE sheet, you should definitely do it: takeuforward.o...
    You can also get in touch with me at my social handles: linktr.ee/take...

КОМЕНТАРІ • 3,3 тис.

  • @takeUforward
    @takeUforward  2 роки тому +597

    The notes are added to the description :) Keeping the blackboard size as it is because I don't wanna stretch it and lose over quality. Cannot upload more than 1 video daily, because I have a full-time job, and it takes 3-4 hours per video, including editing and all.

    • @cypher7536
      @cypher7536 2 роки тому +8

      Best best best!!!!!! ❤️❤️

    • @沼氨
      @沼氨 2 роки тому +5

      Thanks for making these videos. It's astonishing that you can run your channel in such scale when having another full-time job!

    • @PriyanshuSingh-hc3bf
      @PriyanshuSingh-hc3bf 2 роки тому

      Please increase the font size😶‍🌫😇

    • @TonyDUsopp
      @TonyDUsopp 2 роки тому +3

      @@coding8000 you'll give the editor salary ?

    • @akshitmangotra5370
      @akshitmangotra5370 2 роки тому

      Understood. And thanks for the video ❤️. It's pro explanation

  • @utkarshyadav3401
    @utkarshyadav3401 2 роки тому +641

    Years ahead !!! Striver would be going into history as legend for all IT students!!!! 🙏🙏🙏🙏🙏🙏

  • @yadneshkhode3091
    @yadneshkhode3091 2 роки тому +873

    Thank you for not forgetting us after joining google

  • @arunimaaa
    @arunimaaa 8 місяців тому +96

    My take from the video:
    1. Recursion: each function calls give rise to 2 more: therefore O(2^n)
    2. Memoization: stores in an array: O(n)
    Subproblem results are stored in an array, ensuring that each subproblem is solved only once.
    3. Tabulation: iterative approach and takes O(n) subproblems from the smallest to the largest.
    RECURSION: Top down: We start from answer, go to the base case and then go back
    MEMOIZATION: TOP DOWN: avoids redundant calls done in recursion reducing time complexity
    TABULATION IS: Bottom up: We start from the base case and we try to go to the required answer

  • @bibs24
    @bibs24 2 роки тому +235

    I am not a master of recursion but i completely understood the whole lecture and enjoyed it!
    This is my first dp video that I watched and I am totally comfortable with it
    Thanks striver bro❤️

  • @Mohini-rt4wu
    @Mohini-rt4wu 5 місяців тому +11

    DP is very fancy word even after having 10yrs of experience I wasn't sure what is DP, you explained it really well. Thanks.

  • @AbhinavSingh-up7bl
    @AbhinavSingh-up7bl Рік тому +85

    brother #Striver
    Date 17/06/23
    I start watching your video at night 2 Am and now it is 6:30 Am feeling very sleepy but the ( energy + enthusiasm ) you are showcasing in this video make me motivate to watch more 2 and 3 videos , Really nice content with great knowledge

  • @shivangisingh1988
    @shivangisingh1988 2 роки тому +74

    I am blown away with the quality of the content and especially the optimization of space complexity at the end ...Literally nobody started DP with this clarity and precision....More power to you striver

  • @ritikshandilya7075
    @ritikshandilya7075 4 місяці тому +6

    @Striver I am wising I started following your content 2 years back , seriously its a goldmine . Thanks for all what you do for tech community for free.

  • @bhaswatiroy1433
    @bhaswatiroy1433 2 роки тому +12

    Not "just understood" but a different level of understanding. Hats Off !!!!!!

  • @harshitaSharmaE
    @harshitaSharmaE 2 роки тому +133

    Omg raj!!! The amount of energy with which you delivered is really appreciated even a person will wake up from sleep😂😂 and most of people including me has already solved this problem but I was unaware of tabulation and space optimization... I was that involved in the lecture ki pata nahi chala kab 30 mins hogaye. Thank you raj for this amazing series definitely going to follow this

  • @ranveerkumar3532
    @ranveerkumar3532 11 місяців тому +13

    love the energy you have put in the entire video. it motivates me to watch 2,3 more lecture in one go.

  • @vamshipaidimarri983
    @vamshipaidimarri983 Рік тому +21

    I have started very late with DP Series but I am speechless after the video. Fibonacci looks like basic stuff for everyone but the way you have curated it using Memoization, Tabulation and Optimized (No extra space) deep rooted in my mind ("Understood"). Hats off brother!!! This gives me more energy and confidence to complete DP Series.

  • @spytonic4171
    @spytonic4171 2 роки тому +17

    This guy is going to revolutionize the entire Indian coding community with his simple and clear explanations of very hard topics
    thanks for the videos and notes and everything they are very helpful

  • @sai-mu9hj
    @sai-mu9hj 6 місяців тому +6

    the videos of dp series are good,you will fall in love with the first video itself

  • @adarshanku7988
    @adarshanku7988 2 роки тому +11

    I have finally started after procrastinating for such a long time and now i feel why didn't i started earlier, because after the very first lecture, i have got addicted to this.
    And this energy our STRIVER has.......ohh god he is really the Virat Kohli of programming world.
    And hell yeah UNDERSTOOD !!!
    You are really an inspiration for me. LOVE and RESPECT

  • @tg62672
    @tg62672 2 роки тому +33

    The energy this guys put in videos is just awesome

  • @Zomb-zj4ip
    @Zomb-zj4ip 3 місяці тому +3

    understood. I cannot believe such quality content is for free, you are amazing

  • @tusharnain6652
    @tusharnain6652 2 роки тому +33

    I am learning first time "dp" and I understood whatever you taught . Thank you striver bhai ❤️

  • @RavinderSingh-qb4xi
    @RavinderSingh-qb4xi 2 роки тому +47

    Hope someday I'd have good problem solving skills like you ❤️.

  • @ritikeshraj4261
    @ritikeshraj4261 Місяць тому +1

    watched your videos during college placements 3 years back , now back here for another interview. Keep up the awesome work man !

  • @snehilsinha4689
    @snehilsinha4689 2 роки тому +9

    I think there's a small bug in the space optimized code. For n=0, the output will be 1,instead of 0, as prev is storing 1. Hence, we should write a seperate if check for n=0. Rest all looks good.
    The final code should look like ->
    class Solution {
    public:
    void fib(int n) {
    if(n==0){
    cout

    • @Jason-qm8mu
      @Jason-qm8mu Рік тому

      I didn't get it bro ,can we connect I'd ur on LinkedIn

    • @yathdixit
      @yathdixit 9 місяців тому

      @@Jason-qm8mu he is trying to say if we calculate the value of f(0), it will give output as 1 because prev is 1, and output is prev + prev2. He just added a condition of n == 0.

  • @jayantmishra6897
    @jayantmishra6897 Рік тому +14

    this man is helping more than thousand of students at free of cost.the content provided by him is better than any paid course and the topics covered by him are very tough but the way he explains solution are extraordinary.

  • @ankitdas7757
    @ankitdas7757 2 місяці тому +2

    bhai jay jagannath 🙏 ....
    you are the legend for all CSE student

  • @kapilpatel9379
    @kapilpatel9379 2 роки тому +9

    Understood a lot of this even without studying your recursion series, now will go and watch the recursion series

  • @ankitadas5833
    @ankitadas5833 2 роки тому +16

    What A energy ⚡ level You have! And You explained everything such a detail.. When You throwing your lecture it seems like you are into it. That's why the Lecture is best in UA-cam. Thank you so much!

  • @SwatiSingh-ys6hm
    @SwatiSingh-ys6hm Рік тому +5

    Finally starting with DP series that i had been putting off for a long time...A wonderful lecture by striver as always. You are truly the best. Words are not enough to express my gratitude for your videos. You have made several difficult topics easy for me. I bet this one is going to be just as wonderful. Hopefully i can master this topic too by the end of your playlist. Oh forgot ..."UNDERSTOOD !!"

  • @stankafan6688
    @stankafan6688 2 роки тому +18

    you are vardaan for IT students.
    Thank you God for sending a teacher like you. 🙏😇❤

  • @kaushiksen2190
    @kaushiksen2190 10 місяців тому +1

    Thank You So much dada. Just got started with this amazing DP series. I manifest to have improved in DP, Graph, Tree, my DSA skills, my CP skills and work at a top product based company in the next couple of months. Thank You Striver, Thank You Universe, I am very grateful

  • @falgunitagadkar4097
    @falgunitagadkar4097 Рік тому +17

    Your energy while you speak is just amazing and ofc no doubt the best content!!!
    Hats off to you Striver!✌

  • @keshav_k_0793
    @keshav_k_0793 Рік тому +22

    STEP1 Create a dp[n+1] array initialized to -1.
    STEP2 Whenever we want to find the answer of a particular value (say n), we first check whether the answer is already calculated using the dp array(i.e dp[n]!= -1 ). If yes, simply return the value from the dp array.
    STEP3 If not, then we are finding the answer for the given value for the first time, we will use the recursive relation as usual but before returning from the function, we will set dp[n] to the solution we get.

    • @suchithkumargm
      @suchithkumargm Рік тому +1

      please pin this comment...its very useful

  • @lassim6714
    @lassim6714 18 днів тому

    i'm beyond thankful!, those are indeed the best videos on DP!!

  • @anikethdeshpande8336
    @anikethdeshpande8336 Рік тому +4

    i have learnt graphs from your graphs series, it was amazing , helped me understand the main concepts
    excited about DP !

  • @veerpratapsinghrathore7610
    @veerpratapsinghrathore7610 Рік тому +4

    Nothing can be better than this; I understood the whole thing, and by the time you optimised that space complexity to a complexity of 1, I was totally gone, like, "Man, this person is just out of this world." Thank you, Bhaiya, for this wonderful explanation.

  • @prabhatverma1019
    @prabhatverma1019 2 місяці тому

    the O(1) space comp. concept was really help for me and amazing approach.

  • @amanwarudkar9913
    @amanwarudkar9913 2 роки тому +6

    The way you teach stuffs by deep dive into it is amazing man...
    It's easy to understand what you teach because the way you teach.
    Hats off to your hardwork and dedication!!!

  • @piyushsaxena6243
    @piyushsaxena6243 2 роки тому +6

    understood all the concepts, so easy to grasp as u teach so good , thanks for these lectures bhaiya

  • @vishious14
    @vishious14 10 місяців тому +2

    Loved the way you related everything to recurrence relation.

  • @rishabhkalra9505
    @rishabhkalra9505 2 роки тому +8

    thanks Raj for this. I have always been scared of DP like a lot of people. I hope this really helps me to improve myself in DP. God bless you man.

  • @sauravfarkade7032
    @sauravfarkade7032 Рік тому +5

    No one can beat the Energy level of striver while he teaches any concept🤩

  • @aryansirohi8334
    @aryansirohi8334 9 місяців тому +1

    I have always been scared of DP . But this video is Great . I understand DP in One video. God Bless You Man. ❤

  • @sparshsharma6068
    @sparshsharma6068 2 роки тому +17

    A suggestion for those who are learning live, keep the live chat hiddden until and unless it is necessary. This series will be lit! 🔥and yes liked shared and understood

  • @datkumar1024
    @datkumar1024 2 роки тому +4

    Great Playlists! Please add Time-stamps as it makes it easier to jump to required parts

  • @harikeshkumarsharma9834
    @harikeshkumarsharma9834 5 місяців тому +1

    Nothing better than this SIR ...... Thank you so much SIR 🤟🤟🤟

  • @agrawalhimanshu
    @agrawalhimanshu 2 роки тому +11

    First Comment on the amazing Series of DP ❤️🔥

  • @Vadya-nq8mg
    @Vadya-nq8mg 5 місяців тому +28

    Bro don't scream at me, I am afraid xD

  • @sanzayy
    @sanzayy 8 місяців тому +1

    Thanks brother ... for removing the fear of dp..... very well explained basics,,,

  • @miragranger4685
    @miragranger4685 2 роки тому +7

    Understood! Thank you Striver :)
    #include
    using namespace std;
    //Top-down approach
    int FibonacciMemoized(int n, vector & memo){
    if(n

  • @mihiradarsh7604
    @mihiradarsh7604 2 роки тому +4

    Yooooo Let's goo, Finally👏👏
    Understood, the best part is the optimization of the space complexity which you explained✌✌

  • @dfssghh
    @dfssghh 11 днів тому

    "Understood"..
    Thanks for providing us with wonderful DP series Playlist

  • @dipakpatil4370
    @dipakpatil4370 2 роки тому +6

    the best course ever, one small request
    brother if possible add timestamp's

    • @soujitd
      @soujitd 2 роки тому

      Yeah it'll be reallu helpful

  • @codewithme6499
    @codewithme6499 2 роки тому +5

    Thank you for tbe efforts.can u please explain java code as well😊
    "Understood"

    • @takeUforward
      @takeUforward  2 роки тому +3

      Added in notes, its almost similar. Not a big diff.

  • @SelvaArumugam-xq5mf
    @SelvaArumugam-xq5mf 9 місяців тому

    I understood its like a piece of cake walk and mastered your recursion playlist which made me recursion look very easy

  • @shivamehta6537
    @shivamehta6537 2 роки тому +6

    Please upload at least 2 videos per day if already recorded🙏🙏
    btw loving your teaching

  • @manasvinsharma1740
    @manasvinsharma1740 2 роки тому +12

    Please take some variations also other than standard dp problems

    • @rox_official9407
      @rox_official9407 2 роки тому

      Yess sir

    • @raviashwin1157
      @raviashwin1157 2 роки тому +3

      @@rox_official9407 yes something different from Aditya Verma dp series

    • @rox_official9407
      @rox_official9407 2 роки тому +1

      @@raviashwin1157 btw he was my clg alumni

    • @rox_official9407
      @rox_official9407 2 роки тому

      @@raviashwin1157 bhai me Aditya verma ka dekhu kya phele ?
      Ya sirf yahi dekhunga to kam ho jaega

    • @raviashwin1157
      @raviashwin1157 2 роки тому

      @@rox_official9407 Dekh le bhai time hai to 2x me bhi ho jayega aaram se

  • @RakshithVrishab-ht8vk
    @RakshithVrishab-ht8vk 11 місяців тому +1

    Great Explanation! Huge Respect to you Striver Raj.
    and of course, "Understood"

  • @ritik1857
    @ritik1857 2 роки тому +4

    My dream is to put Indian flag at the top on codeforces. 1 billion Indians and we can't even manage to be in top 10.
    I will do it one day.

    • @SS-kt9ml
      @SS-kt9ml 2 роки тому

      India's average iq is 82 even 1 gazillion can't do it.

    • @ritik1857
      @ritik1857 2 роки тому +5

      @@SS-kt9ml I hope you understand that average IQ of a country doesn't imply shit when it comes to individual performance.

  • @manojkr2362
    @manojkr2362 11 місяців тому +1

    watching dynamic programming playlist second time ,let's do this shift and let me crack my interview, i have already got placed , and cleared first 2 rounds in ZOHO company with my 40% skills in DSA, now i have to level up my skills to next level , to this i have to complete this play list let's do this

  • @AKmr3000
    @AKmr3000 6 місяців тому +1

    Started learning DP today...."understood" it.

  • @kaushalkishormusic
    @kaushalkishormusic Місяць тому

    Happy Teacher's day Striver. Just came here to tell you how much you've taught me and helped me grow. You're the best❤

  • @LemesaElias
    @LemesaElias Місяць тому

    This is the best dp playlist not just one of the best.

  • @saavysisters
    @saavysisters 4 місяці тому

    understoodddd , tomorrow i have a technical round interview, literally i am watching this today ,so much thank you striverrrr always a big fannnnnnn

  • @ShivanshuSharma-jz5yq
    @ShivanshuSharma-jz5yq 3 місяці тому

    Getting started with DP from today. This video made me clear with the concept of dp! I mean what dp really is. I hope to complete the whole series by 19th of july(next month). Thanks for this great content.

  • @senseiAree
    @senseiAree 9 місяців тому +1

    Understood.
    I have written it in a similar fashion using the cyclic transfers of a constant space array
    public int fib(int n) {
    if(n

  • @nikhil_1852
    @nikhil_1852 Місяць тому

    bhai is bande ka sikhane ka swag hi alag hai...goat

  • @vibhavsharma2724
    @vibhavsharma2724 5 місяців тому

    I "understood" like never before. Thanks to striver.

  • @stith_pragya
    @stith_pragya 9 місяців тому +1

    Understood......Thanks a lot Striver Bhaiya.........🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @dhruvgupta2634
    @dhruvgupta2634 3 місяці тому +1

    Understood. Amazingly Explained 🌟

  • @_unblemished_soul_581
    @_unblemished_soul_581 7 місяців тому

    Previously I scared only by taking the name of dsa, now I feel that I can also do it. All thanks to you striver bhaiya.

  • @prasangsayzzhii
    @prasangsayzzhii 2 місяці тому +1

    Understood. Your videos are amazing man.

  • @SamPrakashM
    @SamPrakashM 10 місяців тому

    your explanation was exordinary .. Thank you for the explanation

  • @aswinpradeep1287
    @aswinpradeep1287 6 місяців тому +1

    So glad i came across your channel.

  • @125_neeladityaghosh2
    @125_neeladityaghosh2 3 місяці тому

    Thank You so much Sir 😃...Your explanation cleared all my doubts

  • @shivamchaudhary9476
    @shivamchaudhary9476 22 дні тому

    Wonderful explanation. Completely understood.

  • @everythingabout3479
    @everythingabout3479 2 місяці тому

    What a energy sir . Best explanation ever

  • @nishithiyer
    @nishithiyer 3 місяці тому

    Understood! Brilliant videos and playlists. ♥ur work and you are such an inspiration to us all.

  • @aakashyadav8142
    @aakashyadav8142 2 місяці тому

    Wow Striver ! , I am big fan of dedication and hard working. Salute you sir !!
    Understood 🙏🙏🙏

  • @Mr_Kaif__
    @Mr_Kaif__ Місяць тому

    Excellent video, appreciation beyond words.

  • @saurabhgoel8191
    @saurabhgoel8191 8 місяців тому

    Thanks man! Your videos really makes everything easy to understand moreover the program Dry run also helps understanding the approach behind it.

  • @TON-108
    @TON-108 12 днів тому

    Understood!
    Its 2024 still no one is able to match your level ⭐⭐

  • @paraskamboj1039
    @paraskamboj1039 27 днів тому

    There is a test case like when user enters 0 then this gives 1 as an output but it should give 0. So we have to check one condition also i.e if(n==0) { cout

  • @ahmedyassercomputerscience
    @ahmedyassercomputerscience Місяць тому +1

    thank you Raj Understood.

  • @AmanPandey-bd1sj
    @AmanPandey-bd1sj 4 місяці тому

    Understand🎉
    It's the best playlist ever

  • @SanthoshaK-px8rq
    @SanthoshaK-px8rq 4 місяці тому

    TO understand only i taken one day. i don't know how many days you are taken to make this video. any use full for me Thank you.

  • @rahulkumarkeshriiitbhu3932
    @rahulkumarkeshriiitbhu3932 3 місяці тому +1

    The man the myth the striver ❤

  • @dhruvdangi8923
    @dhruvdangi8923 Місяць тому

    just amazing sir , super easy explanation .

  • @prabhakaran5542
    @prabhakaran5542 10 місяців тому +1

    Understood Bro! Heartful Thanks for your effort!

  • @SoyaibZihad10
    @SoyaibZihad10 9 місяців тому

    DP journey is about to start. Excited.

  • @mahindev1112
    @mahindev1112 2 місяці тому +1

    Thank you so much for amazing and usefull content!

  • @maheshsonnari8013
    @maheshsonnari8013 5 місяців тому

    striver is one of the best teacher out there teaching dsa on yt

  • @NirmalyaMusicOfficial
    @NirmalyaMusicOfficial 2 місяці тому

    Understood completely in detail 💯

  • @hruthikahp6016
    @hruthikahp6016 9 місяців тому

    Thank you strivers because you are doing DSA course in English

  • @Nishantmhshwari
    @Nishantmhshwari Рік тому

    Understood 🔥 best explanation.. i leaned this in O(1) from u ... Earlier it was O(n) everytime i need to see the video to recall 😂 but now its in my DP array 🤣

  • @quickturns76
    @quickturns76 7 місяців тому

    your works are absolutely appreciable ,thank you so much sir!

  • @ronaksiddhpura07
    @ronaksiddhpura07 9 місяців тому

    I was Understood concept very well.

  • @TheSpiritualOne401
    @TheSpiritualOne401 11 місяців тому

    Striver you cannot be human, you are definitely a god, Please do more videos and also please try to post videos on OOPS concepts. It will really help us. Thank you Striver dada

  • @DhruvGupta-f3n
    @DhruvGupta-f3n 2 місяці тому

    Understood!! what a level of energy!

  • @striverdaaadi
    @striverdaaadi 9 місяців тому

    understood very well sir

  • @aakash6651
    @aakash6651 11 місяців тому

    Currently i'm in my third year and i'm pretty average at coding.Your lectures made me feel DP easier.I started observing some patterns .

  • @studynewthings1727
    @studynewthings1727 Рік тому +1

    Thankyou STIVER, I understood.