4.9 Longest Common Subsequence (LCS) - Recursion and Dynamic Programming

Поділитися
Вставка
  • Опубліковано 22 лис 2024

КОМЕНТАРІ • 748

  • @LetsBeHuman
    @LetsBeHuman 6 років тому +1495

    Give this man a medal. In 23 minutes, he covered all 3 ways and DP with 2 examples.
    Just couple of suggestions to win much more subscribers
    1) For your videos at least allow auto-translate
    2) Instead of directly pasting the code, you can do think-out loud and tell us how you arrived at that code.
    Man, you deserve a round of applause.

    • @trango1658
      @trango1658 6 років тому +8

      many thanks from MONTREAL xxx

    • @bipinbhandari8781
      @bipinbhandari8781 5 років тому

      True!

    • @soumilyade1057
      @soumilyade1057 5 років тому +2

      and also, how to code for memorization. One such example would clarify the concept even better.

    • @narharimotivaras79
      @narharimotivaras79 5 років тому

      true bro! Hatsoff to this Man!

    • @azadalishah2966
      @azadalishah2966 4 роки тому +3

      Soumilya De Memoization ( not memorisation). It means store the result in data structure of ur choice and read from it in next call instead of recalculating again & again. Thus it become faster. If u r not clear let me know.

  • @prachid3990
    @prachid3990 3 роки тому +119

    This is the 60th video I am watching from this playlist, and literally have not come across a single negative/criticising/jealous comment!! Such is the aura of an amazing professor!!
    Thank you Sir!

  • @dhruvpatel9957
    @dhruvpatel9957 6 років тому +709

    Attended zero lectures but understood everything from you. I'm a fifth sem student and.....god bless you sir 🤟🤟🤟🤟.

  • @charlesrodriguez6276
    @charlesrodriguez6276 4 роки тому +76

    I'm not afraid to say that this man single-handedly got me through algorithms. Thanks for being my and the world's algorithm teacher. You are certainly up to the task!

  • @pionerogroup9081
    @pionerogroup9081 6 років тому +147

    I didn't understand anything in my class when my teacher was teaching this topic and I did not even try to understand because I knew that It will be clear only by Abdul sir's videos.
    You are Great man

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

      so now tell me what didi you understand

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

      @@techinframes longest common subsequence, duh

  • @mateussoares7421
    @mateussoares7421 2 роки тому +20

    Hello Abdul, how are you?
    I'm writing this comment just to say that I loved you video and I'm very grateful that there're people like you ready to share knowledge for free that's gold!!!!
    Thank you very much!

  • @scholli99
    @scholli99 6 років тому +95

    this guy really understands what he is talking about, unlike the others! Thumbs UP!

  • @TheAndreve
    @TheAndreve 4 роки тому +71

    From México, I agree with all the previous comments. Your explanation is clearer than my algorithms course. Great job sir!

  • @vigneshp9994
    @vigneshp9994 3 роки тому +11

    So Mr. Abdul Bari has decided to single-handedly save me from all those unhelpful college lectures. Good, Very good. Thank you :)

  • @praneetsingh9695
    @praneetsingh9695 6 років тому +35

    you are one of the best teacherr ..happy teacher's day sir

  • @saunakroy2587
    @saunakroy2587 6 років тому +5

    Watched all your UA-cam videos from scratch. Teaching in that way, which is simple to understand and will also be quickly absorbed by the students is an ART. You have got this brilliant ART sir. I have grasped all these concepts before college via your videos. Thanks a lot for providing knowledge for free. You are a real teacher and i hope that you will continue teaching us more through your videos.

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

    I develop, design and lead efforts for various initiatives at Oracle. Even with 13+ years of experience I come back to this amazing man to appreciate his simplicity.
    Dear Sir,
    Your simplicity in explanation is infectious. It motivates me to go back to college one more time and appreciate how amazing it is to learn from a teacher like you. God bless you. :) :)

  • @onkartiwari5742
    @onkartiwari5742 3 роки тому +6

    I did not no about this gem earlier. how easily he explain the things. thank you so much sir. May god give you all the happiness.

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

    You are my role model in explaining concepts Teacher Abdul. Interesting, clear, and well-paced. I can't thank you enough for sharing this for free. I appreciate you and hope one day I can contribute to maintaining your courses.

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

    Hi Professor Bari--THANK YOU SO MUCH for the videos!!! I'm currently a cs undergrad student taking basic algorithm, and I'm very confused by what I'm learning from school. But I'm so glad I found your videos because you made every algorithm SO CLEAR to me!!! I'm cramping for my midterm this coming Tuesday and having a meltdown because I'm so confused about the algos and your videos saved me. THANK YOU for all your great work!!!

  • @archardor3392
    @archardor3392 3 роки тому +4

    Amazing! How come I have never thought of this solution! So trivial it seems but only when presented to you by such a master! Days, no Weeks of confusing and trying it on my own and now I see clarity! Amazing presentation!

  • @bizzey2714
    @bizzey2714 4 роки тому +5

    I’m doing my master's in CompSci and these videos help me in undersyanding the working of the problems so well -- my prof is so so bad omg

  • @coopjmz9627
    @coopjmz9627 3 роки тому +1

    Best algorithm teacher ever! Gotta love the dramatic way you turn to the camera at the end of your videos, when you know everything is explained and all the viewers understood!

  • @shanthansai6377
    @shanthansai6377 4 роки тому +468

    The dislikes are from the lecturers/professors who can't teach as good as him.

    • @ManishKumar-rz9ub
      @ManishKumar-rz9ub 4 роки тому +5

      🤣🤣🤣

    • @kapilgupta8543
      @kapilgupta8543 3 роки тому +23

      No, few dislikes are because he just shows how algorithm works. Instead of showing how one can approach the solution without knowing solution already. Because approaching the solution is more important than mugging up solution. For example, he just showed the code for recursion without explaining one can think of writing that code without knowing the solution already.

    • @FranVarVar
      @FranVarVar 3 роки тому +6

      ​@@kapilgupta8543 I think that cannot be taught. You just make tables with examples, fill them manually and try to see a pattern. That is my guess but I am not an expert!

    • @rahmasamy7463
      @rahmasamy7463 3 роки тому +4

      @@kapilgupta8543 exactly

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

      My madam explained it in more detail like him as well but I am going to these for revision. So, not every teacher is like u all thought if u listen to them carefully they will also cover all these topics

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

    I have been struggling with LCS understanding and this person has made it look like a cake walk. This is the best explanation.

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

      Bro can you explain to me why sir taken lcs as "ONE" and not a S in the Sequence Is there a reason in second question

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

    The way he teaches is amazing.
    I failed to understand this topic in my college but you are the man who helped me understanding this topic
    I m first semester student of BVoc(software development and E governance)
    Thanks sir 🙏🏻❤️

  • @小郭子游戏-v4r
    @小郭子游戏-v4r 6 років тому +6

    too good. I wish all the professor can do and explain like you, so I can understand LCS long time ago. Thank you so much

  • @andreysaenko9057
    @andreysaenko9057 3 роки тому +1

    just want to say - WOW. Very clear description of LCS problem.

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

    our college needs a professor like You Sir ji. Please Complete a series of PYQ of GATE C & DSA. ap hamesha happy and healthy rhe sir ji

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

    I watched MIT lecture on dynamic programming multiple times but this 23 min video cleared all the doubts I have.

  • @MustafaKHAN-sw1xb
    @MustafaKHAN-sw1xb 6 років тому +37

    This tutorial is better than others

  • @mayurbajaj5517
    @mayurbajaj5517 6 років тому +15

    Great to see you here Sir, I have attended your classes in ACE for DBMS and CN in 2011 and let me tell you I still hold the notes from your classes and are very very helpful for any interview prep. Thanks a ton (bow)..!!! One suggestion I would like to give for this video is in case of DP solution if you could have explained how the code is derived that would have been more understandable.

  • @muzammilmueen3487
    @muzammilmueen3487 6 років тому

    Awesome .. The best part is that he spent good amount of time to clarify what is the 'actual problem' he will solve ... 10 / 10.

  • @sameersondur9030
    @sameersondur9030 5 років тому +1

    I really appreciate your way of teaching. Not even for a moment, you made me feel like this is a very complex topic. I have seen very few teachers teach this way.
    This makes me think how to communicate better with my colleagues. I think the opposite person should not feel like it is a complex issue.

  • @allahakbar9580
    @allahakbar9580 5 років тому +9

    I am not even a computer programmer and I understand what he's saying! He's wonderful!

  • @jimmyp4584
    @jimmyp4584 5 років тому +5

    We can’t thank you enough sir. Simply can’t. Such simple and beautiful way of explanation of complex topics.

  • @Jay-jf4ux
    @Jay-jf4ux Місяць тому

    This man teached us a 2hour lesson in just nearly 30 min. 💐💐💐💐 Bravoooo

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

    i saw many videos to solve lcs problem but did not understand, this is the only video that i understand, aap bahut accha padhate hai sir

  • @mirrannas.6892
    @mirrannas.6892 4 роки тому +1

    After a horrible horrible lesson about this topic and leave with confusion, I am watching this video and finally understand the topic. Thank you so much ❤️

  • @madinab3610
    @madinab3610 5 років тому +6

    OMGSH, YOU MAKE IT SO CLEAR.
    Thank you so much for all your hard work with finding the correct examples and making this video so neat and short, but complete. Thank you soo much!

  • @aashishdagar3307
    @aashishdagar3307 3 роки тому +1

    I have tried multiple resources,but you are best sir.
    Time investing here on this channel is worth.
    Thanks you sir.

  • @chinmaydas4053
    @chinmaydas4053 6 років тому +65

    You are the best sir...one problem with ways solution..just great.
    Lots of respect..

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

    This guy is single-handedly giving us all our CS degrees despite the terrible profs some of us have in our algo uni courses! Props to this guy, liked and subbed 👌

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

    This gentleman is teaching better than my Uni lecturers. He deserves special thank you.🙏🙌🥇🥇🥇🥇

  • @pastafarian8410
    @pastafarian8410 5 років тому

    Thank you mr.Bari. Last time I had watched your video , I picked up a very little. Now I could understand thoroughly because I had worked out this problem and it cleared my all doubts and I can apply it some other problems . Moral of the story is work out more problems and come to a such an intelligent teacher .

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

    I thought I'd never understand this buy Abdul is an absolute lifesaver. Round of applause

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

    after struggling through lot of documents, this video gave me complete and satisfying answer.😊

  • @GauravMahajanAvaron
    @GauravMahajanAvaron 5 років тому

    FINALLY! A video that doesn't have super-technical language and the entire method is so easy to understand.

  • @shabashachi1238
    @shabashachi1238 6 років тому +6

    Sir, what are subjects , you are teaching?
    Your teaching method is best.
    If I listen your video,
    Then no class, no book is required.

  • @vikasjha8975
    @vikasjha8975 5 років тому +9

    this man is doing great job by helping students with his videos may god fill his all dreams. best wishes )-

  • @nitishroy6538
    @nitishroy6538 5 років тому +1

    Arey ye itna aasaan hai :) sir, huge respect... guru purnima pe apko naman hai

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

    This man is a legend, cant say anything more!

  • @siddharthmehta4223
    @siddharthmehta4223 Рік тому +27

    15:04 for dynamic programming

  • @venkateshnagubandi754
    @venkateshnagubandi754 4 роки тому

    One of the best Teachers for programming on UA-cam

  • @sarksou
    @sarksou 3 роки тому +1

    Sir,
    I saw this video after watching multiple dp youtube video but somewhere there was gap. But you're amazing, from today any topic first I will search in your channel.. You're too good if there is a match add 1 taking value from previous diagonal else max of previous row/colum.. Superb too good.. Bottom up, top down too good. I wish I watch this video before my amazon interview

  • @prashanthikuchana4144
    @prashanthikuchana4144 6 років тому

    There are lot of videos on LCS but this the best and clear explanation I've seen so far. Thank you and my respect to you sir.

  • @abhinavjha3828
    @abhinavjha3828 4 роки тому

    Sir You are the best Professor I have ever seen teaching in this simple and effective way

  • @rishabhbandi3368
    @rishabhbandi3368 4 роки тому

    Sir you are God Gifted. By only listening to your videos before exam brings back the confidence. Not everyone can teach as calmly and confidently like you! Thanks a ton for being saviour of so many students.

  • @Ayushsharma-qc7qx
    @Ayushsharma-qc7qx 2 роки тому +2

    Just pure teaching
    best in the whole universe
    and also in multiverse 🛐

  • @minhazurrahman8592
    @minhazurrahman8592 6 років тому

    Never understood the diff between memoization and tabulation,thought they were both dp approach.I've just learnt it right now!Best explanation I've found on the internet till now!

  • @niteshyadav247
    @niteshyadav247 Рік тому +2

    Pay attention to how he uses plain recursion first, then memoization reduces number of calls(2^n --> m.n), and then he uses dynamic programming which is still O(m.n) but it outperforms recusrsions because recursive functions take a lot os space on the call stack and are generally slower tha for loops, every new way of solving the same problem adds to the performance, i used to jump directly to dynamic programming without understanding the problem it solves you can only truly understand(and appreciate) dynamic programming if you're coming from recursion

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

    Never got this much easy explanation of recursion. Thank you so much sir for the video

  • @divyanshsharma8983
    @divyanshsharma8983 5 років тому

    Sir, you are the first person who made me think about dynamic programming so comfortably,....TONS OF RESPECT

  • @kakashisenpai99
    @kakashisenpai99 5 років тому +15

    Those dislikes are from people who are jealous of his easy teaching. Crystal clear explanation sir. Thank you ❣️

    • @bharataaryavrat4067
      @bharataaryavrat4067 3 роки тому

      can you see my mistake ,i am geeting wrong answer
      #include
      using namespace std;
      #define ll long long
      // string dp[4001][4001];
      vectordp(4001,vector(4001,""));

      int main()
      {
      string s1,s2;
      cin>>s1>>s2;
      ll n=s1.length();
      ll m=s2.length();
      for(ll i=0;i

  • @utkarshpaliwal411
    @utkarshpaliwal411 5 років тому

    Sir, you are God. The way you explained the problem moving from Recursion to DP, explaining at each step the ways in which we can better the current solution, helped me understand this question which used to give me nightmares. Thanks a lot !

  • @uditkumar7211
    @uditkumar7211 3 роки тому

    Sir is legend what my teacher couldn't explain in 3 lectures Sir explained in 23 minutes Hats off

  • @md.fazlerabbi675
    @md.fazlerabbi675 5 років тому

    sir you are best. this ALGO course cost me 24k. but my course faculty even don't know what he is teaching.
    thnx sir

  • @yuxinzhang5094
    @yuxinzhang5094 6 років тому +8

    Best algorithm tutorials I've seen. Lots of respect!

  • @SoyJayP
    @SoyJayP 5 років тому

    I understood it right away watching this video after spending a long time to understand it from other blogs.

  • @gringoire986
    @gringoire986 6 років тому

    Seriously the way this guy explains is the best.

  • @ahmedalif9989
    @ahmedalif9989 5 років тому

    Just awesome!!!! My university's lecturer was failed to explain it and made it hard for everyone. You make it so easy as possible. Hats off sir!

  • @nraghu99
    @nraghu99 4 роки тому

    You are the best sir, like someone said, congress has to give you a medal fpr spreading the light

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

    Thanks sir, your explanation is awesome. I love how you explain every single step using hand writing. Clear concept, this is all I need, the rest is just need to convert it to any programming language. I hope you are always healthy there

  • @finfan2101
    @finfan2101 4 роки тому +1

    Honestly speaking, this is better than Tushar Roy's explanation.

  • @ayushshukla3000
    @ayushshukla3000 4 роки тому

    went to 3 places and here I found the simplest of explanation
    Thank You Sir

  • @jamesjassi37
    @jamesjassi37 5 років тому

    Sir you deserve dhronacharaya award.... 🙏🙏🙏🙏🙏Bestest explanations

  • @coledrain2158
    @coledrain2158 5 років тому

    My lecturer just explained it to us vaguely. But now I see why some things happen.
    Thank you Sir.

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

    This man deserves a medal.

  • @DridhaNishchay
    @DridhaNishchay 4 роки тому +1

    You are great Sir. Saviour of all students. Hats off to you. Thank you.

  • @Mayank612722
    @Mayank612722 6 років тому

    In my yesterday's exam, recursion and LCS weighed 24/80 marks. Your other videos really helped me. Thanks. Subbed.

    • @Mayank612722
      @Mayank612722 6 років тому

      Abdul Bari Sir I was revising using your videos all through 18th April night till early in the morning of 19th. Thanks for the work you do. Thank you.

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

    Thank you sir you helped me in passing my exam

  • @anirudhreddybasani3555
    @anirudhreddybasani3555 6 років тому

    Probably u are the only one who have made such a large number of videos on topics related to competitive programming...lots of respect🙌 sir

  • @atheist00123
    @atheist00123 3 роки тому +1

    Was Trying to figure this algo out. I have never seen anyone teach better.

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

    I love you😂 I got this video in my recommendation 1 hour before my exam and this problem was the "hard" task of my exam :)

  • @nournote
    @nournote 5 років тому +2

    Thanks very much. That was crystal clear.
    I have a remark though : as far as I know, ameliorating recursion with memoization is still considered DP in the literature.

    • @AfroMuggleKing
      @AfroMuggleKing 5 років тому

      exactly!! dp can be done using tabular method(bottom up) or recursion with memozation(top down). Got confused when he said now will do it using dp.

  • @poojaarora6912
    @poojaarora6912 5 років тому +1

    Sir, all your videos of ADA are really very well explained. I will pass in my exams only because of you....
    Lots of respect and love to you!

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

    Abdul is brilliant. Wow. I wish dp was as intuitive for me as it is for him.

  • @Arjun-yd6cf
    @Arjun-yd6cf 4 роки тому +1

    Awesome explanations.
    It would be better if you can explain why the addition is made to the diagonal element when a match is found and why the max of the other two is taken else. That helps in understanding the problem and solution deeper.

  • @ehsanhosseini5861
    @ehsanhosseini5861 4 роки тому

    This is the greatest video I have ever seen. Thank you Abdul, you are the best.

  • @rentedunicorn
    @rentedunicorn 6 років тому

    This is the best explanation I have seen for LCS.

  • @skubydubydu
    @skubydubydu 6 років тому

    Please make more videos. Your explanation was the easiest to understand among all the videos I have seen for this algorithm.

  • @PhuongNguyen-mg8ss
    @PhuongNguyen-mg8ss 4 роки тому +7

    Thank you so much, Sir. Your lectures helped me survive in my class during Covid-19:x

  • @金不二
    @金不二 3 роки тому

    OMG, this algorithm is so awesome. And the explaination is crystal clear. Much appreciated!

  • @zeroone8137
    @zeroone8137 6 років тому

    Simply superb. I felt like your lectures were similar to ravindra babu sir's lectures.Both of them lectures are very useful to understand the concepts very clearly. Hands off

  • @TravellerMann
    @TravellerMann 6 років тому

    In simple words..Its WOW !!!
    Perfect explanation..

  • @aleladebiri
    @aleladebiri 4 дні тому +2

    You're the GOAT.

  • @nickharalampopoulos
    @nickharalampopoulos 3 роки тому

    Hello Bari, you are one of my favorite teacher, and one of the best on youtube. Thank you for all your efforts.

  • @Jaxkr1
    @Jaxkr1 5 років тому +3

    Best algorithms channel on youtube.

  • @cpsarathe
    @cpsarathe 4 роки тому

    LC explanation is the best i saw here. god bless you brother .

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

    Thank you so much! Your explanation is awesome and easy to understand. professors like you are the ones who create the best students!🙌

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

    23 minutes of pure teaching excellence

  • @yessinekammoun1997
    @yessinekammoun1997 4 роки тому

    Lovely explanation, you have just explained in 23minutes what my teacher didn't explain in 2 hours :D

  • @khadijahalsmiere3718
    @khadijahalsmiere3718 6 років тому +1

    you saved my life Sir .. thank you very very very much .. //from KSA .

  • @mini22q11
    @mini22q11 5 років тому

    Hats off sir :) I have done my btech in 2010 that time i afraid to read DP but wen i started to read with ur videos they r quick one :)

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

    Thanks to your lectures I can revise again