Graph Algorithms for Technical Interviews - Full Course

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 พ.ค. 2024
  • Learn how to implement graph algorithms and how to use them to solve coding challenges.
    ✏️ This course was developed by Alvin Zablan from Structy. Check out Alvin's channel: / alvintheprogrammer
    🔗 Learn data structures and algorithms: structy.net/
    ⭐️ Course Contents ⭐️
    ⌨️ (0:00:00) course introduction
    ⌨️ (0:02:23) graph basics
    ⌨️ (0:07:10) depth first and breadth first traversal
    ⌨️ (0:29:13) has path - structy.net/problems/has-path
    ⌨️ (0:42:11) undirected path - structy.net/problems/undirect...
    ⌨️ (1:00:44) connected components count - structy.net/problems/connecte...
    ⌨️ (1:13:29) largest component - structy.net/problems/largest-...
    ⌨️ (1:24:03) shortest path - structy.net/problems/shortest...
    ⌨️ (1:39:36) island count - structy.net/problems/island-c...
    ⌨️ (1:58:52) minimum island - structy.net/problems/minimum-...
    ⌨️ (2:12:05) outro
    🎉 Thanks to our Champion and Sponsor supporters:
    👾 Wong Voon jinq
    👾 hexploitation
    👾 Katia Moran
    👾 BlckPhantom
    👾 Nick Raker
    👾 Otis Morgan
    👾 DeezMaster
    👾 Treehouse
    👾 AppWrite
    --
    Learn to code for free and get a developer job: www.freecodecamp.org
    Read hundreds of articles on programming: freecodecamp.org/news

ความคิดเห็น • 690

  • @chriskorbel6796
    @chriskorbel6796 2 ปีที่แล้ว +633

    This guy is phenomenal. His course on dynamic programming was exceptionally well done as well.

    • @mauricemarin5810
      @mauricemarin5810 2 ปีที่แล้ว +7

      A little old comment, but exactly my thought, I just went through his dynamic programming course and completely agree

    • @akshayagrawal2222
      @akshayagrawal2222 2 ปีที่แล้ว +5

      @@mauricemarin5810 same here

    • @elad7264
      @elad7264 2 ปีที่แล้ว +5

      Hi, @Chris can you add a link to the dynamic programing course. Thanks

    • @chriskorbel6796
      @chriskorbel6796 2 ปีที่แล้ว +1

      @@elad7264 th-cam.com/video/oBt53YbR9Kk/w-d-xo.html

    • @kk11223
      @kk11223 2 ปีที่แล้ว +2

      Agreed
      after that course, I am so confident on DP.

  • @Randomisticful
    @Randomisticful 2 ปีที่แล้ว +137

    Einstein once said "If you are able to explain it to a 5 year old, you understand it yourself". Alvin, you are one of a kind!

    • @syedtalha1264
      @syedtalha1264 3 หลายเดือนก่อน +2

      Richard Fynman said that.

    • @Randomisticful
      @Randomisticful 3 หลายเดือนก่อน +3

      @@syedtalha1264 I also said that, hey!

    • @Zenoandturtle
      @Zenoandturtle 2 หลายเดือนก่อน +2

      Another immortal quote: ‘I stand on the shoulders of giants’ was attributed to Isaac Newton, as it turns out he wasn’t the one who coined it.

    • @frankmasby6099
      @frankmasby6099 2 หลายเดือนก่อน +2

      I can verify that I’m 5 and I do understand this thanks to this video.

  • @Basta11
    @Basta11 2 ปีที่แล้ว +68

    Leetcode - O(n^2) brute force.
    Algoexpert - O(n) linear
    Alvin / Structy - log(n)

    • @howhello354
      @howhello354 2 หลายเดือนก่อน

      😂😂 True

  • @kanakmittal3756
    @kanakmittal3756 2 ปีที่แล้ว +30

    Man! you have my respect. This was the best course for getting started with graph problems I have ever seen. Thank You so much.

  • @radhikatupkary7875
    @radhikatupkary7875 2 ปีที่แล้ว +23

    This is phenomenal! I was finding Graph problems so difficult before watching this video, and now they seem fairly easy after watching the entire video! Thanks a ton!

  • @MARIUTSKI13897
    @MARIUTSKI13897 2 ปีที่แล้ว +94

    I'd always been scared of learning graphs, even though I wanted to... but this course took my fear away 😎👍🏻 excelente course, as always!

  • @sede189
    @sede189 2 ปีที่แล้ว +13

    This course is hands-down, unequivocally fantastic!!! Best useful course I've seen about graphs. It ties together the algorithms with concrete use cases which just clicked. Thank you for the fantastic job!!!!

  • @Cdswjp
    @Cdswjp 2 ปีที่แล้ว +4

    “Later on in the tutorial we’ll go over examples of when u might use one over the other”
    What a breath of fresh air 🙏🏼

  • @Niki-pc5zk
    @Niki-pc5zk 2 ปีที่แล้ว +9

    This is the only course I’ve found that has successfully got the concept of graphs through my thick skull, it’s been a subject that’s been so hard for me to learn. Thank you for making this!!

  • @ChillAutos
    @ChillAutos 2 ปีที่แล้ว +17

    This was amazing. I've watched a bunch of these types of videos over the years and this is the only one that actually made it look easy. I can actually say I understand this now. Thank you.

  • @ragzzytv
    @ragzzytv ปีที่แล้ว +82

    I'm a mid/senior level webdev and I just come back to Alvin's videos when preparing for interview everytime. its so simple and help me rebrush all of them without much hassle. very good work

    • @ordinarygg
      @ordinarygg ปีที่แล้ว

      you probably use parent_id = .. db.Column in your projects, don't you xDDD

    • @shayorshayorshayor
      @shayorshayorshayor 7 หลายเดือนก่อน

      ​@@ordinaryggew.

    • @callahan7257
      @callahan7257 4 หลายเดือนก่อน

      @@ordinarygg Don't get it.

  • @hklbly
    @hklbly ปีที่แล้ว +8

    I chose this video after I got an invitation for an online test from a well-known company. This was my only chance since I have never studied algorithm oriented programming.
    I was given a graph problem and handled it correctly with a minor deficiency in efficiency :) Thanks a lot!

  • @utkarshrastogi8791
    @utkarshrastogi8791 2 ปีที่แล้ว +52

    Was looking for something like this and can't beleive you just uploaded it!

  • @saishsankhe
    @saishsankhe 10 หลายเดือนก่อน +6

    Before watching this course, I dreaded DFS BFS problems. I always used to somehow understand the logic just before the interview and then forget everything. But now, I understand the logic, visualization and how to appraoch it. Thank you so much Alvin and FCC for this. I am definitely going to watch other interview videos. 👍

  • @tobylerone007
    @tobylerone007 2 ปีที่แล้ว +2

    This was probably the most useful tutorial I've seen on YT. Great work!

  • @vibhushajain6363
    @vibhushajain6363 2 ปีที่แล้ว +2

    Thank you for making graphs so easy for me! Appreciate your patience to make these videos and share

  • @zeryabalam7042
    @zeryabalam7042 2 ปีที่แล้ว +20

    This course is exceptionally well done. Completely understood the theory and implementation behind them damned graphs.

  • @bambamgam
    @bambamgam ปีที่แล้ว +2

    Huge fan of these courses, he's a great teacher and breaks down these problems to be far less intimidating

  • @VinodKumar-wh1mq
    @VinodKumar-wh1mq 2 ปีที่แล้ว +3

    You're doing an amazing job Alvin👍I'm always on lookout for your contents. Thank you!

  • @johnnychang3456
    @johnnychang3456 ปีที่แล้ว +4

    OMG this video is an absolute gem! I used to be baffled by the island problem and just simply memorizing the solution on leetcode, but after following along for two hours, I can confidently code up the solution all by my self! Thank you so much you are a fantastic teacher.

  • @punith023
    @punith023 2 ปีที่แล้ว +6

    Thanks Alwin for this great tutorial. I had been trying to understand and get an answer to a similar set of problems for a very long time. You made my day, ...probably my life!

  • @Annant05
    @Annant05 2 ปีที่แล้ว +1

    Thanks for the video. To be honest, this is one of the best graph tutorials I have ever witnessed. My core concepts and understanding towards this Data Structure has improved and I really appreciate the efforts you have put in to make this video.🙏

  • @ahbarahad3203
    @ahbarahad3203 2 ปีที่แล้ว +2

    Thank you Alvin, loved the DP course and this one as well

  • @varunshridhar1310
    @varunshridhar1310 2 ปีที่แล้ว +107

    The course on DP was a winner. Course on Graph algo is another winner. Hope to learn a lot more from you.

    • @keerthi1070
      @keerthi1070 2 ปีที่แล้ว +9

      you are another winner for appreciating him :)

    • @ziggystardust3763
      @ziggystardust3763 2 ปีที่แล้ว +5

      @@keerthi1070 you are another winner for appreciating another winner

    • @Tetrax
      @Tetrax 2 ปีที่แล้ว +1

      @@ziggystardust3763 you are a winner for appreciating a winner appreciating a winner

    • @ldar6472
      @ldar6472 2 ปีที่แล้ว +6

      @@Tetrax this recursive call stack gotta stop somewhere XD

    • @Tetrax
      @Tetrax 2 ปีที่แล้ว +2

      @@ldar6472 let’s assume we’re on an alternate universe where leetcode doesn’t have a time limit

  • @alexneagoe5258
    @alexneagoe5258 2 ปีที่แล้ว +2

    I am actually studying C but I have found this video tremendeously helpfull in explaining how graphs are traversed and how not to use return in a bad way when you want to actually make use of recursion to backpedal from dead ends in situations where you don't find your base case.
    thank you again. subscribed!

  • @alessiocelentano6895
    @alessiocelentano6895 2 ปีที่แล้ว +5

    I never comment on TH-cam, but I love the way Alvin explains concepts. Thanks a lot for your work!

  • @yadikishameer9587
    @yadikishameer9587 2 ปีที่แล้ว +5

    This guy literally changed the way I look at dynamic programming.

  • @johnsontian2733
    @johnsontian2733 2 ปีที่แล้ว +1

    Thank you Alvin! Your explanation is GOLD!!! It's such a phenomenal tutorial that I find myself learning so much more efficiently!

  • @amarjeetchaurasia2811
    @amarjeetchaurasia2811 2 ปีที่แล้ว +5

    Never looked graph so easy to me before I watched this one, thanks! 😊

  • @alexandra_reznikov
    @alexandra_reznikov 2 ปีที่แล้ว +3

    Definitely was looking for this! Thanks! ❤️

  • @steventolerhan5110
    @steventolerhan5110 หลายเดือนก่อน

    Honestly one of the best tutorials ive come across in my 2 years of coding. Good work Alvin

  • @jerinjohnkachirackal
    @jerinjohnkachirackal ปีที่แล้ว

    This is really really a complete tutorial for “Graph based Problems” both in terms of coding Problems, interview preperation including MAANG and even for a new bie.

  • @pandeyaashish6544
    @pandeyaashish6544 ปีที่แล้ว +2

    Preprocessing the input by storing edges in hashmap: this line took all my fears of not even trying to attempt graph problems to making me feel I could do any graph problems. Thanks for this video ❤️

  • @staywithmeforever
    @staywithmeforever 20 วันที่ผ่านมา

    This was not for coding interviews but a good start for beginners who are into graphs with perfect visualization

  • @tickkun7901
    @tickkun7901 2 ปีที่แล้ว

    めちゃくちゃ分かりやすかった!!
    Alvinさんありがとう!!

  • @kelvinmuza7034
    @kelvinmuza7034 2 ปีที่แล้ว +3

    My guy, I don't know how to thank you. You have a marvelous way of teaching. This has really helped me a lot

  • @mandihaase2744
    @mandihaase2744 2 ปีที่แล้ว +1

    All of Alvin's content is amazing! I signed up for Structy after doing this course and the course on trees, and love it!

  • @RandomShowerThoughts
    @RandomShowerThoughts ปีที่แล้ว

    easily the best teacher of algorithms I've ever seen. Alvin spends time going over theory, Big O notation, and common errors. As someone that's never studied algorithms and data structures, all the videos he has done have helped drastically

  • @mounishsavier5774
    @mounishsavier5774 2 ปีที่แล้ว

    Your voice is so soothing too! Amazing video, i've always had a bit of a block when it comes to these graph algorithms but your approach/explanations finally helped me grasp them!!

  • @eternalwanderer8166
    @eternalwanderer8166 2 ปีที่แล้ว

    Thank you so much. This is the only video on TH-cam which addresses the graph algorithms the way they should be addressed - graphical visualization, pseudocode and actual problem solving.

  • @princeadigwe3764
    @princeadigwe3764 2 ปีที่แล้ว +9

    How this person managed to explainamy concepts perfectly is superb... We really need people like this guy in the teaching field... I downloaded the video and I ve not regretted at all

    • @jimmybellmon1268
      @jimmybellmon1268 2 ปีที่แล้ว

      Me too I just realized Breathe First Traverse is Fibonacci

  • @symbol767
    @symbol767 2 ปีที่แล้ว

    The best beginner graph tutorial.
    I always come back to this to refresh myself on graphs.

  • @adityabyreddy
    @adityabyreddy ปีที่แล้ว +5

    This is amazing. I found it really easy to understand the graph algorithms after referring to this video. Great job, Alvin :)
    Small correction in the solution described for checking if a source and destination have a path in an undirected graph. (line no. 8)
    The logic of traversing the neighbors and adding the source node to the visited list has to be part of the condition that validates whether ta node is visited or not.
    if !(visited.has(src)) {
    // add the src to the visitors list
    // recursively traverse through the src neighbors
    }

  • @pz5109
    @pz5109 2 ปีที่แล้ว +2

    Just finished the Dynamic Programming from Alvin and now back at the Graph algorithm.

  • @TheBarthinator
    @TheBarthinator 2 ปีที่แล้ว

    Wow amazing how you made me understand graphs and I have extreme comfortability with the recursive approach and queue method. Always struggled understanding these implementations in python but as a web dev it made a lot more sense in JS. Thank you for taking the time to make this video!

  • @rahul-qo3fi
    @rahul-qo3fi 2 ปีที่แล้ว +4

    watched your lecture on Dynamic Programming and now I am here. You are such a phenomenal teacher, thanks a ton for making these tutorials!

  • @venkateshkagalavadi7824
    @venkateshkagalavadi7824 2 ปีที่แล้ว

    Sooper excited for this!! Thanks you! Your DP course is excellent!

  • @theegreatestever2420
    @theegreatestever2420 2 ปีที่แล้ว

    Have yet to work on this but want to express my gratitude and wish you greatness in all aspects of your life!

  • @vinayrajagopal5478
    @vinayrajagopal5478 ปีที่แล้ว +28

    This is a great intro to basic graph problems - however we may need a part two to cover more advanced topics such as Union Find, Minimum Spanning Trees, Dijkstras & bellman ford, topological sort, etc.

    • @anonymousanonymous6411
      @anonymousanonymous6411 ปีที่แล้ว +1

      Sure we totally need. Code interview for wannabe juniors requires some of advanced topics

    • @theLowestPointInMyLife
      @theLowestPointInMyLife 11 หลายเดือนก่อน +2

      Guaranteed you won't actually need any of that when actually building something in the real world.

  • @bikkikumarsha
    @bikkikumarsha ปีที่แล้ว +2

    Changing lives, one algorithm at a time. Great work Alvin!

  • @webcodingoprogrammingtips2090
    @webcodingoprogrammingtips2090 2 ปีที่แล้ว +7

    Awesome work! You inspired me to start my coding channel!

  • @yunaf4609
    @yunaf4609 2 ปีที่แล้ว

    By far the best video that I have ever seen on this topic, thank you for all the effort you put into this Alvin!

  • @OEThe11
    @OEThe11 ปีที่แล้ว +2

    This was an elite video. I did the last two questions and did not understand how to approach it or understood what the right answer for those questions. Watch the 2+ hours of video as well as coding it up myself, and everything makes sense. EVERYTHING. I am now able to do one of the toughest topics that I was having trouble with. So BIG Thank You for that.
    P.S. For the last 2 questions, you don't need the visited set, you can flip the land to water or another value altogether. Avoiding the cyclic infinite loop.

  • @franklinghosh4317
    @franklinghosh4317 2 ปีที่แล้ว +85

    Wow!, Your DP course was phenomenal, now you came up with Graph theory too, Thank you

    • @AlvintheProgrammer
      @AlvintheProgrammer 2 ปีที่แล้ว +13

      Glad to hear you found value in my content! More coming soon.

    • @vinayaktyagi8773
      @vinayaktyagi8773 2 ปีที่แล้ว

      @@AlvintheProgrammer what next ?

    • @mz_dreamminister
      @mz_dreamminister 2 ปีที่แล้ว

      @@AlvintheProgrammer this is really true! you are the best!

    • @AlvintheProgrammer
      @AlvintheProgrammer 2 ปีที่แล้ว +4

      @@vinayaktyagi8773 Likely trees or linked lists next. You can check out my platform, Structy (link in the video description), if you want to check it out early before it premiers on free code camp.

  • @JeremiKress
    @JeremiKress 2 ปีที่แล้ว

    Finished my very first fCC course. The pedagogy is excellent, Alvin is a great teacher

  • @kirillzlobin7135
    @kirillzlobin7135 6 หลายเดือนก่อน

    Your explanation is ideal. Voice and the way you expalin does not make a listener tired. This is just amazing. Please continue doing your job. It is amazing

  • @codecleric4972
    @codecleric4972 2 ปีที่แล้ว

    I thought I'd seen the all the greatest of online coding instructors, and then I found Alvin... Seriously these explanations are paced exactly perfectly and ultra clear

  • @kirillzlobin7135
    @kirillzlobin7135 6 หลายเดือนก่อน +2

    So logical and calm and fantastic explanation. This is just unbeliveble :) How you can explain this stuff so easily. You are the legend

  • @jayp3573
    @jayp3573 2 ปีที่แล้ว

    I learned more from this tutorial then all other tutorials that I watched combined. Great videos man!

  • @chibuzorisrael5878
    @chibuzorisrael5878 5 หลายเดือนก่อน

    Thank you so much, Alvin, I have always been intimidated by graphs. This is the best course you will ever stumble across on graphs.

  • @RandomShowerThoughts
    @RandomShowerThoughts ปีที่แล้ว

    this was such a great course, literally understood every aspect of it. Was able to do the problems after your explanations

  • @manivannansivaraj7324
    @manivannansivaraj7324 ปีที่แล้ว

    Thanks for this video tutorial, Alvin!
    It helped me to understand graphs, graph traversals and most common graph related tech interview problems much better.

  • @Aman-rm1hq
    @Aman-rm1hq 2 ปีที่แล้ว

    He makes it look so easy, wish I had jumped across these tutorials earlier. But will use them now.

  • @minciNashu
    @minciNashu ปีที่แล้ว +2

    34:04 E = N*(N-1) for directed graphs. So in that example, 3 nodes means 6 edges (not 9, as in 3 squared)

  • @alanalmeida7887
    @alanalmeida7887 2 ปีที่แล้ว +1

    Thanks a lot! just finished the first section (dfs and bfs) and it got soldered into my brain! well taught!

  • @paulpapacz3000
    @paulpapacz3000 2 ปีที่แล้ว

    Amazing walkthroughs and explanations! Much appreciated 🙏

  • @nativeKar
    @nativeKar 2 ปีที่แล้ว

    What a great series! Learnt so much in just under 2 hours!

  • @brothermalcolm
    @brothermalcolm 2 ปีที่แล้ว

    Thanks to the first 30mins of this video alone I was able to extend the idea of adjacency lists and independently solve all the following problems on undirected graphs and grid graphs in just under a week's worth of practice

  • @cateyenebula
    @cateyenebula ปีที่แล้ว

    As an embedded software engineer, I never learned about these kind of algorithms. This is invaluable knowledge for me, thanks for leveling up my skill!

  • @agustinvargas6973
    @agustinvargas6973 2 ปีที่แล้ว +1

    This is fantastic. Makes graphs easy to digest. Thanks for that.
    I did find a minor issue in the island count problem solution.
    It assumes that each row will have the same number of columns. That assumption isn't described in the problem. So a quick fix would be to run the nested loop to the length of the row instead of fixing it to zero. And doing the same for the inbounds check. That would present an issue in the exploration in that there might not be any map in either direction, so you'll have to add an existence check in the explore to account for that.
    This way if a row has less coordinates, or more, it would still work properly.

  • @user-pz3wj3yk2x
    @user-pz3wj3yk2x 9 หลายเดือนก่อน

    Really awesome walkthrough - thanks Alvin!!

  • @threekingdoms99
    @threekingdoms99 2 ปีที่แล้ว

    Thank you, Alvin.
    Your explanation is very clear and easy to understand!

  • @Spaaace
    @Spaaace 2 ปีที่แล้ว

    100% the best teacher I've seen. You are legit the best, my dude.

  • @johnbell5195
    @johnbell5195 2 ปีที่แล้ว +8

    For island count (1:58:20), you actually don't need a visited set to keep track of the tiles you have already visited. Simply set the land tile to water "W" when you visit it; you already have the logic there to skip over water tiles.

    • @Damian-cd2tj
      @Damian-cd2tj ปีที่แล้ว +7

      Yes, but in real life, functions don’t modify input objects, it’s a bad practice. In an interview I wouldn’t do it without asking.

    • @manumathew2846
      @manumathew2846 ปีที่แล้ว +1

      If space complexity needs to be minimized and the interviewer allows in-place modification, then this is a good approach.

  • @517Amit
    @517Amit ปีที่แล้ว

    I am following Alvin's last couple of series DP, Graph. Really enjoying his teaching. Appreciate.

  • @MIDNightPT4
    @MIDNightPT4 2 ปีที่แล้ว

    Splendid! Alvin is an incredible instructor

  • @Kidkromechan
    @Kidkromechan ปีที่แล้ว +1

    Thank you for the video. Also to find the minimum sizes of the island, we can use the method that calls the recursive function (parent method) to hold an integer that points to the size of the visited set before the recursive call and then use the difference in size after the recursive call to determine the minimum size. This to me didn't require me to create a new recursive method that returns an integer. However, creating an extra method does have its benefits too.

  • @sergiim5601
    @sergiim5601 ปีที่แล้ว

    Amazing introduction to graphs! Very well explained !

  • @ignaciorubio
    @ignaciorubio 2 ปีที่แล้ว +4

    Congratulations on this course, really well explained by Alvin.

  • @bhuvan9956
    @bhuvan9956 10 หลายเดือนก่อน

    Love you man. You make things so easy. Please do more courses. Will support you to the moon.

  • @evieuyenta8764
    @evieuyenta8764 2 ปีที่แล้ว

    by far the best tutorial!!! i finally am getting better at this. THANKS A TON!

  • @adiljamshad215
    @adiljamshad215 ปีที่แล้ว

    I literally have no words to express how mind-blowing Alvin is.

  • @Q_Ultimas
    @Q_Ultimas 2 ปีที่แล้ว +2

    Thank you, this helps in brushing up on basic graph stuff :)

  • @sumedhaj9017
    @sumedhaj9017 ปีที่แล้ว +1

    Thanks so much for uploading this! The approaches are clearly explained

  • @astHakobyan
    @astHakobyan 3 หลายเดือนก่อน

    Great video Alvin. When you describe it, it seems piece of cake. Good job.

  • @rawatpraveen1000
    @rawatpraveen1000 2 ปีที่แล้ว

    wow your explanation is just amazing! Never thought it would so easy.

  • @alyshagilliard7498
    @alyshagilliard7498 2 ปีที่แล้ว

    This was so gooooood!! Watching all the other ones. So glad I found this!

  • @doug6577
    @doug6577 2 ปีที่แล้ว

    This is awesome! I've been struggling with graphs until I saw this video, great course.

  • @ashleypowell8066
    @ashleypowell8066 6 หลายเดือนก่อน

    Here because Alvin's DP video was amazing. This is another gem. Thanks!!!

  • @KCML036
    @KCML036 ปีที่แล้ว

    amazing video on graphs. Relearning graphs now and this has been very useful. Thank you!

  • @xxxplayerblyatxxx8992
    @xxxplayerblyatxxx8992 3 หลายเดือนก่อน

    Wonderfully constructed! Helped me a lot for the unit covering Graphs in my University coursework.

  • @entcune
    @entcune 2 ปีที่แล้ว

    You made such high level topic like a walk in park thanks alot man. Waiting for more such videos from you.

  • @Sean-gx1sf
    @Sean-gx1sf ปีที่แล้ว

    One of the most useful videos I've seen for understanding data structures, awesome

  • @surajshah3590
    @surajshah3590 ปีที่แล้ว

    Great tutorial Alvin. For python programmers, here is the pattern for largest components (connected components is similar):
    def explore(arr, node, visited, comp_count):
    if node in visited:
    return 0, visited
    visited[node] = 1
    for neighbour in arr[node]:
    comp_count += 1
    explore(arr, neighbour, visited, comp_count)
    return comp_count, visited
    def largestcomponent(arr):
    largest_comp = 0
    visited = {}
    for node in arr:
    if node not in visited:
    comp_count, visited_new = explore(arr, node, visited, 1)
    visited = visited_new
    if comp_count > largest_comp:
    largest_comp = comp_count
    return largest_comp

  • @apple2092
    @apple2092 ปีที่แล้ว

    thanks for posting this course. Very practical and concise. Great job!

  • @lulusaikou221
    @lulusaikou221 2 ปีที่แล้ว

    Wonderful video!!! I am familiar with graph now, thank you Alvin💕 I will follow your next video and looking forward to your more courses. Thanks fcc too.❤

  • @ar2zee
    @ar2zee 2 ปีที่แล้ว

    Love your explanation , you are the best ! Thanks for the course!

  • @shayakghosh7496
    @shayakghosh7496 2 ปีที่แล้ว

    Great explanation, thanks a lot. You are the reason i learnt a great deal about dynamic programming.

  • @benzz22126
    @benzz22126 ปีที่แล้ว

    please do a similar video for weighted graphs. alvin has the best teaching style. clear concise with helpful drawings!!!

  • @AnaPaula-ec4mh
    @AnaPaula-ec4mh ปีที่แล้ว +2

    Fantastic. Thank you so much for this amazing explanation!