4.2 All Pairs Shortest Path (Floyd-Warshall) - Dynamic Programming

Sdílet
Vložit
  • čas přidán 15. 02. 2018
  • Floyd-Warshall All Pairs Shortest Path Problem
    Dynamic Programming
    PATREON : www.patreon.com/bePatron?u=20...
    Courses on Udemy
    ================
    Java Programming
    www.udemy.com/course/java-se-...
    Data Structures using C and C++
    www.udemy.com/course/datastru...
    C++ Programming
    www.udemy.com/course/cpp-deep...

Komentáře • 1,2K

  • @karanpuri1617
    @karanpuri1617 Před 5 lety +1826

    you're a perfect example of how a CSE Teacher should be.

    • @sundaramsaroj2087
      @sundaramsaroj2087 Před 3 lety +14

      Very true!!!!!!

    • @justinjohnson7717
      @justinjohnson7717 Před 2 lety +14

      Correct 😀. This is my homework. I did my homework with the help of this video. 😁

    • @karanpuri1617
      @karanpuri1617 Před 2 lety +1

      @@abhaykumarkanaujia abbe chuttad vo mujhe class mein ni padhata.

    • @karanpuri1617
      @karanpuri1617 Před 2 lety

      @@abhaykumarkanaujia ab tujhe gadhe ko yahan bi ni samajh aaya to fir chhod hi de tu

    • @omsatpathy5455
      @omsatpathy5455 Před 2 lety +3

      @@karanpuri1617 chodh bhai wo production waala hai😂

  • @riley_6913
    @riley_6913 Před 4 lety +439

    In less than 15 minutes you managed to clearly explain something my professor couldn't explain in an entire semester. Eventhough I'm late relative to when this video was uploaded, I still wanted to take this time to thank people like you, who provide an invaluable service to us all.

    • @devbhavsar7799
      @devbhavsar7799 Před 2 lety

      I think your syllabus is shit..my college does not teach me only warshall for 6 month

  • @mr.aravindreddy
    @mr.aravindreddy Před 3 lety +1567

    Sir At 6:39 I think for A^1[4,2] the value is 5 but not 8.

  • @jd7073
    @jd7073 Před 5 lety +428

    Dear sir,
    You have been an incredible help in my studies. I didn’t understand my courses very Well Because the teacher wasn’t the greatest, But Thanks to you i was able to pass all my finals! I am so grateful for these amazing video’s and i truly hope you Will continue to make such Good video’s! You are one of the best teachers when it comes to algorithms, bravo!

    • @lucutes2936
      @lucutes2936 Před rokem

      ZOV

    • @Gowtham_1188
      @Gowtham_1188 Před měsícem

      Atleast you have teachers to teach, but in my college no lectures, no labs, no proper mid exams and they say it is as self learning , faculty don't even know subject to teach, we only go to college only for attendance.😢

  • @ssshukla26
    @ssshukla26 Před 4 lety +165

    I am just passing my algo exams because of you sir. Thank you so much...

  • @tausifahmad2007
    @tausifahmad2007 Před 4 lety +1045

    sir i think at 6:39 for A-1[4,2] there will be 5 not 8

  • @Sa-jx6rm
    @Sa-jx6rm Před rokem +15

    I have never been so jealous in my life
    How lucky they are whom have the opportunity to attend your classes . Truly, you are the best professor ever ! thank you so much

  • @Gagandeep-ou7cs
    @Gagandeep-ou7cs Před 5 lety +215

    Btech walon ke liye masiha ho aap.

  • @sachinprabhuk6241
    @sachinprabhuk6241 Před 5 lety +19

    I just started watching your tutorials and even though they are a lil longer compared to other tutorial channels, its soo worth it. You have such awesome insight on the concepts. Thank you very much. Keep up the awesom work

  • @JohnCena12355
    @JohnCena12355 Před 6 lety +20

    Thank you so much! the instances of matrices is a unique way of teaching this and made me understand instantly! Much better than starting with the algorithm and following from there. Bravo!

  • @JoseSanchez-vv1zd
    @JoseSanchez-vv1zd Před 4 lety +18

    Greetings from southern California! You make learning algorithms so much easier and interesting! Thank you for your great work, Abdul!

  • @ayushsharma397
    @ayushsharma397 Před 6 lety +92

    thanks, sir ! hats off to your efforts, you are providing quality lectures on algorithms.The best material available on youtube would say
    .

  • @jr.shivendra4271
    @jr.shivendra4271 Před 5 lety +224

    I shared a link of this video to my professor........and next day he thanked me.

  • @who_fkn_cares
    @who_fkn_cares Před 5 lety +4

    Your ability to clearly explain algorithms is very effective. One of the best teachers I've come across. I look forward to your other videos.

  • @thefahad449
    @thefahad449 Před 3 lety +12

    Your students are lucky to have a professor like you. I wish all my professors thought CS like you do!

  • @Virtualexist
    @Virtualexist Před 3 lety +5

    You are so humble, explanations are simple. This shows the skill of an awesome teacher- explaining anything such that anyone can understand. 🙏

  • @akaari3820
    @akaari3820 Před rokem +6

    Didn't understand anything in a 90 minutes lecture, immediately understood the algorithm after just 4 minutes of this video. You're legendary

  • @qiyueliang6089
    @qiyueliang6089 Před 2 lety +3

    Very good logic, very clear explanation, very nice example, makes me understand the idea immediately after watching the first half of the video without having to check other information. You're one of the best lecturers I've ever seen!

  • @triarii9257
    @triarii9257 Před 3 lety +1

    Thank you so much! Your videos are well titled and by far the best explanations on CZcams. PS: Love those long pauses where you look at the camera like a professor giving a student time to absorb it all.

  • @silvasilkfern3752
    @silvasilkfern3752 Před 5 lety +2

    Thank you so much for making these videos! It's crazy how much better I understand Floyd-Warshall now

  • @samsmith1583
    @samsmith1583 Před 6 lety +3

    Really appreciate your effort of such a patient explanation. This really helped me to understand the problem that I wouldn’t figured out maybe for hours merely by reading book.

  • @Joqu1nn
    @Joqu1nn Před 3 lety +7

    This could not have been a more concise and clear lesson. Thank you sir

  • @vijaybabaria3253
    @vijaybabaria3253 Před 4 lety +1

    Respect, You made some of the concepts so easy to understand... That I should have known 20 years ago but skipped it in school because it was hard to grasp.. thank you very much for all the clarity... Amazing quality

  • @monkeytrollhunter
    @monkeytrollhunter Před 4 lety +6

    Thank you sir, I have final exam for my algorithms class next week. You're a great supplement for me when I try to understand the materials. Greetings from the U.S !

  • @Superalexandru2
    @Superalexandru2 Před 4 lety +7

    Thank you professor for this wonderful explanation! Your videos mean so much to students all over the world.
    Greetings from Politehnica University of Bucharest ! (Romania)

  • @josepaul2725
    @josepaul2725 Před 5 lety +196

    Correction A1 matrix (4,2) = 5

  • @applenrd
    @applenrd Před 6 lety

    I must have watched a dozen videos on Floyd Warshall and this is the only one I actually understand... THANK YOU SO MUCH!!!!!

  • @kamenpetkov192
    @kamenpetkov192 Před rokem +4

    My Algorithms teacher was struggling big time with this one lol. And here, sir Abdul Bari explained it perfectly in 14 minutes. Great teacher!

  • @nickzervas4937
    @nickzervas4937 Před 4 lety +46

    When comparing the Floyd Warshall method with the Djiktra method , i think there are 3 important things you should have pointed out :
    1) The Djiktra method can be achieved with less complexity , especially with sparse graphs .
    By using binary heap as a priority queue we achieve O(n*m*logn) and with a fibonacci heap we achieve O( (m+nlogn)*n).
    2) The main advantage of this method compared to Djiktra is that it can be implemented in a graph even if we have edges of negative weights ( as long as there are no negatives circles ) . Djiktra is highly limited by that aspect .
    3) The best algorithm for this method which benefits both from 1,2 is : Johnsons .
    It can be achieved in O( (m+nlogn)*n) even if we have negative weights ( no negative cycles )

  • @manomay7029
    @manomay7029 Před 2 lety +2

    Wow! What a phenomenally straightforward explanation. Hats off to you, Abdul Bari sir!

  • @jiayuetan8742
    @jiayuetan8742 Před 4 lety

    Soft and gentle tone with clear explanation

  • @lolzlolzlolzlolzlol1
    @lolzlolzlolzlolzlol1 Před 5 lety +1

    his videos have been saving me so much time and effort. wish all professors could be as good as him!! many thanks

  • @ifanwang1796
    @ifanwang1796 Před 3 lety +18

    How come he makes every algorithm so simple to understand, much respect sir!

  • @dryoldcrabman6890
    @dryoldcrabman6890 Před 4 lety +7

    Dude you rock! I was going to end my life but after watching your video you gave me hope.

  • @a_bahador
    @a_bahador Před rokem +1

    In one word. Brilliant! I wish you were my algorithm professor. I have an Algorithm exam in 2 days and if I hadn't seen your videos I would probably fail. You made this course super easy. Thank you so much for everything sir.

  • @nishtha27
    @nishtha27 Před 6 lety +1

    Probably the best explanation of Floyd-Warshall algo, thank you!

  • @soudafathimakurnool6521
    @soudafathimakurnool6521 Před 6 lety +4

    Thank you very much sir for such a clear and efficient explaination..
    I'm Truely benefiting from it!

  • @MoHaMmADAlmo7taref
    @MoHaMmADAlmo7taref Před 2 lety +6

    Well, ngl, it's kind of impressive finding people who can really explain things even better than our teachers! I can finally rest assured if I missed something in the college.

  • @EscapedConvict2007
    @EscapedConvict2007 Před 2 lety

    The best thing happened to me today was stumbling upon this channel. I was just not getting the Floyd-Warshall explanation from wikipedia. The explanation here is crystal clear.

  • @hamzamuslim6141
    @hamzamuslim6141 Před 2 lety

    I literally spent 1 hour right before my exam looking at your videos and understood everything I needed to know highly recommend the dijkstra prim kruskal floyd lessons were amazing.

  • @tabreazahmedzerdi9844
    @tabreazahmedzerdi9844 Před 6 lety +11

    this type of lectures in India for us
    this is really heaven sir

  • @VarunPK_Vlogs
    @VarunPK_Vlogs Před 6 lety +21

    Thank you sir
    I liked ur videos bkz you aren't only trying to make money by these videos.
    You are putting lot more efforts to teach us in an easy manner.

  • @alexboiar5319
    @alexboiar5319 Před 2 lety +2

    Apparently university is just an expensive subscription to youtube. Do unis find teachers who can't teach on purpose to get more money from people retaking the course? Sir, you've been saving my grades for 3 years now! I cannot thank you enough for making such great and easy to understand content. Thank you !

  • @heidarsaleh3455
    @heidarsaleh3455 Před 6 lety

    That's by far the best explanation I've found. Thanks!

  • @gauravkarwa5241
    @gauravkarwa5241 Před 4 lety +3

    Sir your amazing.....wish we had teacher like you in our college!

  • @talhaiftikhar57
    @talhaiftikhar57 Před 4 lety +3

    i submit my all assigment after watching your algorithm videos,thats really helpful.👍

  • @anirudhhada4313
    @anirudhhada4313 Před 2 lety +1

    Whenever my exam comes I see your videos one day before. There are no words for complimenting you. Thank you so much sir for your hard work and dedication!!!!!
    All teachers should be like you......

  • @excitinguniverseofmusictheory

    Thank you! This solved a problem I was working on, beautifully and quickly.

  • @ronitkumar1838
    @ronitkumar1838 Před 6 lety +3

    finally i understand this algo...thank you so much

  • @TM-lf6os
    @TM-lf6os Před 6 lety +10

    Mr. Bari: Thanks so much for your videos. They are very clear and concise, and help me learn these concepts way faster than my expensive professors ever could. You are a god send! Thank you so much for what you do.

  • @epicmoffe
    @epicmoffe Před 5 lety

    Your videos are really good. Both your language and content are really clear, and that is something i can appreciate.

  • @karankhune7311
    @karankhune7311 Před 5 lety

    One of the best Teachers......cleared all my doubts..ws able to complete my syllabus 2days before exam..

  • @CaptainLongNick
    @CaptainLongNick Před 4 lety +5

    I love you, you magnificent creature. You saved both my degree and love life.

    • @ipek2556
      @ipek2556 Před 3 lety +1

      dude wait how did he save ur love life I'm genuinely curious haha

  • @user-fi2ty4bm2n
    @user-fi2ty4bm2n Před 4 lety +19

    I am at almost the end of this semester. Every time after our teacher's lecture, I come here to build the comprehensive concept :")

  • @sakhigundeti6785
    @sakhigundeti6785 Před 2 lety +1

    Sir, thanks to your amazing lectures, I was able to clear my algorithms subject! I don't know what I'd have done otherwise. Keep up the great work!

  • @mallikarjunagoudarahunasi9922

    The way your teaching is super sir!!!
    Getting the points is very easy ,,,thank you.

  • @uniqueelsa5959
    @uniqueelsa5959 Před 2 lety +3

    I've exam in 2 hrs and now I understood why he's called the God of Algorithms

  • @ammarnusair
    @ammarnusair Před 5 lety +3

    You are teaching better than our teacher
    respect ,🙇🏻‍♂️

  • @Cas7nova
    @Cas7nova Před 2 lety +1

    I wish i had someone like you in my college, all of us deserve a teacher like you, you're just phenomenal, thankyou sir for teaching us❤️✨

  • @funshortsguru
    @funshortsguru Před 4 lety

    Abdul bari uplaods videos so long without applying any additional ads. Great Man!

  • @kunalchoudhary7477
    @kunalchoudhary7477 Před 5 lety +28

    correction A^1[4,2]=5.

    • @eurus7509
      @eurus7509 Před 4 lety +1

      I was looking for this comment.I thought i made a mistake taking 5...ty

    • @mitali7959
      @mitali7959 Před 4 lety

      @@eurus7509 same here

    • @srinjoydas1314
      @srinjoydas1314 Před 3 lety

      eggzacly , thanks

  • @TheGodfather101
    @TheGodfather101 Před 4 lety +3

    It says something and I mean REALLY says something about exceptional teaching ability when you have a teacher whose accent is this thick but is vastly superior in facilitation of core concepts than the most elegant English speaker. Mr Bari. You sir are the best teacher of computer science on the web. Period. There are people who pay tens of thousands of dollars for years only to fall short in what you can manage help us achieve in mere hours.

  • @yingtingchen3133
    @yingtingchen3133 Před 4 lety

    Thank you so much for producing this video. You just saved me hours and hours of time trying to go through the unclear explanation in the book (probably only to give up at the end).

  • @gao_yuan
    @gao_yuan Před 3 lety

    Thank you sooo much sir, you made the complex algorithms much more easy and vivid to understand!

  • @syedchand995
    @syedchand995 Před 6 lety +7

    Great experience sir. Plz upload more videos

  • @siddharthmanumusic
    @siddharthmanumusic Před 3 lety +3

    Thank you for the beautiful explanation. One observation: Isn't the time complexity of Dijkstra to find all pairs shortest path same as that of Floyd Warshall? I think the only advantage of FW is that it can also find it for negative weights plus it's easier to implement - no priority queue or extra space complexity.

  • @DeseneleLuiRazvan
    @DeseneleLuiRazvan Před 4 lety +1

    Big man, big character. I've learned a lot of things about graph theory from you. The examples which you make and the theory from Cormen's book are a good combination.

  • @GravitySmashify
    @GravitySmashify Před 6 lety

    Thank you so much. Without a doubt the best video on this algorithm.

  • @abhishekpandey1741
    @abhishekpandey1741 Před 3 lety +4

    I am an undergrad student at IITD I was really having a tough time understanding this but this video made it so easy.....

  • @gregprice3097
    @gregprice3097 Před 5 lety +4

    Thanks Abdul! See you at England v Holland.

  • @TridibSamanta
    @TridibSamanta Před 5 lety +1

    Great ! You are a great Teacher. Thanks for saving my Design and analysis of Algorithm Paper.
    #Respect

  • @camilaperez7580
    @camilaperez7580 Před rokem

    Thank you so much. I understood more in the first 4-minutes of this video than in any of my network flow classes.

  • @Endrit719
    @Endrit719 Před 5 lety +6

    yahahaha my friends were telling me I would fail this subject because of those algorithms because I didn't attend the classes but thank god internet exist I will pass like a boss

  • @sanjeebbaitha96
    @sanjeebbaitha96 Před 6 lety +4

    till 8:31 there was a mistake 4,2=8 instead of 8.....but corrected nice video

  • @Pandreou261
    @Pandreou261 Před 3 měsíci +2

    you are saving my life.Thank you brother. Brother from different mother
    :)

  • @kamranmammadli5850
    @kamranmammadli5850 Před 6 lety

    Searched all of available explanations on youtube and found this one which is perfect. Normally, I stay away from indian accent videos. Thank you sir for very detailed video

  • @Geethanjalireddyy
    @Geethanjalireddyy Před 6 lety +8

    Sir,
    There is a mistake in finding A1
    A1=0 3 α 7
    8 0 2 15
    5 8 0 1
    2 5 α 0
    Can u check it sir....

  • @PankajKP
    @PankajKP Před 6 lety +4

    GOD !!!

  • @lucam9806
    @lucam9806 Před měsícem

    Your explanations are the best. Every week I have to do exercises for the Algorithms and data structures lecture, your explanations help me so much. I really like how you showed the example first, then deduced the formula. It's a lot easier to understand this way. Greetings and big thank you from Germany.

    • @mudassarraza6448
      @mudassarraza6448 Před měsícem +1

      Nice to see people viewing from outside India as well. Gut!

  • @heshansandamal2731
    @heshansandamal2731 Před rokem

    This is a person who actually wants us to learn algorithms. Thank you very much.

  • @chetanktatia2297
    @chetanktatia2297 Před rokem +3

    Guru Brahma guru Vishnu guru deva Maheshwara ,guru shakshat param bhrahma tasmayeshri gurudev namah ,.pranam sir , algorithms guru ji 🙏🙏deep respects sir

  • @heyyou8771
    @heyyou8771 Před rokem +5

    in video - at 8:36 AND 8:38
    they changed the value of A'[4][2]=5 ,
    don't get confuse...

  • @basantakg
    @basantakg Před 5 lety +1

    Thanks for this great lecture! It was very useful for me.

  • @nsami7035
    @nsami7035 Před 4 lety

    Very clean and to the point explanation. Thank you very much sir. You are such an inspiration.

  • @tanujgehlot2600
    @tanujgehlot2600 Před 5 lety +27

    6:40,Correction A1 matrix (4,2) = 5

    • @nusratfans39
      @nusratfans39 Před 5 lety +2

      he wasted my time for this mistake and even confused me

    • @_outcyrptolist
      @_outcyrptolist Před 4 lety +1

      @@nusratfans39 always check for comments when u face such issue

    • @HARIHaran-ks7wp
      @HARIHaran-ks7wp Před 4 lety

      @@_outcyrptolist true dat

  • @shiwanggupta8608
    @shiwanggupta8608 Před 6 lety +2

    Dijkstra takes O(ElogV). So, if we calculate using Dijkstra it would be O(n^3*logn)

    • @shiwanggupta8608
      @shiwanggupta8608 Před 6 lety +1

      For a dense graph E=O(V^2), So, worst case time complexity will be O(ElogV*V)=O(EVlogV)=O(n^3*logn)..

  • @ptreeful
    @ptreeful Před rokem +1

    When I first read about this algorithm, I understood nothing. After your explanation everything is clear, I love you!

  • @Grrmrlg
    @Grrmrlg Před 3 lety

    I gave up the lecture videos from my professors and watched yours. Super helpful.

  • @pranavkasera5584
    @pranavkasera5584 Před 4 lety +3

    Thankyou from NIT Warangal

  • @adithyas6863
    @adithyas6863 Před 3 lety +4

    Our teacher told this is the formula, just memorize it no other go ಠ︵ಠ

  • @yongbinghu6608
    @yongbinghu6608 Před 4 lety

    Amazing video. I've learned so much from you. Thank you, sir.

  • @sohambhattacharya2543
    @sohambhattacharya2543 Před 2 lety

    Sir, your videos are extremely helpful. I was finding difficulty to understand the concept. But got to feel it crystal clear after learning it from you...You are great Sir!!

  • @ashishdwivedi5190
    @ashishdwivedi5190 Před 5 lety +5

    @13:55 isn't the time complexity again n^3 which we were trying to avoid initially??

    • @techwithwhiteboard3483
      @techwithwhiteboard3483 Před 4 lety

      yes it is
      i think the constant term in this asymptotic n3 is lower than simply using djikstra several times

    • @kritikhetan
      @kritikhetan Před 4 lety

      @@techwithwhiteboard3483 even my point is also the same...time complexity as of using dijkstra also n times
      .@abdul Bari sir plz solve this doubt..thanks for wonderful explanation

    • @abdul_bari
      @abdul_bari  Před 4 lety +5

      We were not trying to reduce time. We just saw a different approach

    • @kritikhetan
      @kritikhetan Před 4 lety

      @@abdul_bari thanks a lot sir..was stuck in this concept..ur vedios have cleared lot of my doubts in algorithm

  • @Kvs6263
    @Kvs6263 Před 3 měsíci +5

    how you come up with this bro

  • @abhibajpai5049
    @abhibajpai5049 Před 4 lety

    it's always great to listen you sir...whenever i stuck in a problem u always there...
    thank you sir..

  • @pikaachu1644
    @pikaachu1644 Před 5 lety +1

    It got into my head very easily...love ur videos...much helpful in my studies..way to go sir.....keep posting....

  • @dushyantkaushik335
    @dushyantkaushik335 Před 6 lety +7

    A1[4,2] should be equal to 5 instead of 8

    • @aadityapritam4709
      @aadityapritam4709 Před 5 lety +1

      Ya i thought there should be 5 instead of 8.. But thats ok.. I understand the concept

    • @Ankit-mq6em
      @Ankit-mq6em Před 4 lety

      @@abdul_bari woooowww

  • @markos9712
    @markos9712 Před 6 lety +3

    you are my god, my lovely indian sir god

  • @manojtidke2142
    @manojtidke2142 Před 6 lety +2

    Thanks it helped me a lot. You are really good teacher.

  • @sdsa007
    @sdsa007 Před 3 lety

    Thanks, i have a computer science background, and this video is is helping me understand how the basic ideas are expressed mathematically for dynamic programming.