Graph Algorithms for Technical Interviews - Full Course

Поділитися
Вставка
  • Опубліковано 7 лют 2025

КОМЕНТАРІ • 740

  • @chriskorbel6796
    @chriskorbel6796 3 роки тому +728

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

    • @mauricemarin5810
      @mauricemarin5810 3 роки тому +9

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

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

      @@mauricemarin5810 same here

    • @elad7264
      @elad7264 3 роки тому +5

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

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

      @@elad7264 ua-cam.com/video/oBt53YbR9Kk/v-deo.html

    • @kk11223
      @kk11223 2 роки тому +2

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

  • @Randomisticful
    @Randomisticful 2 роки тому +213

    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 11 місяців тому +4

      Richard Fynman said that.

    • @Randomisticful
      @Randomisticful 11 місяців тому +7

      @@syedtalha1264 I also said that, hey!

    • @Zenoandturtle
      @Zenoandturtle 11 місяців тому +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 10 місяців тому +2

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

  • @ragzzytv
    @ragzzytv 2 роки тому +99

    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 Рік тому

      ​@@ordinaryggew.

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

      @@ordinarygg Don't get it.

    • @atTien-ko1pg
      @atTien-ko1pg 3 місяці тому

      @@ordinarygg i know what u mean Xd, web devs isnt that hard 🗿🗿

  • @hklbly
    @hklbly 2 роки тому +15

    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!

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

      Was that FooBar? Did you finish it? They shut it down 😢

  • @utkarshrastogi8791
    @utkarshrastogi8791 3 роки тому +54

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

  • @Niki-pc5zk
    @Niki-pc5zk 2 роки тому +13

    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!!

  • @david-tracy
    @david-tracy 3 роки тому +21

    “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 🙏🏼

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

    the voice, he style of teaching , the animations and visuals absolutely phenomenal. love it

  • @kanakmittal3756
    @kanakmittal3756 3 роки тому +35

    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 роки тому +27

    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!

  • @varunshridhar1310
    @varunshridhar1310 3 роки тому +116

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

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

      you are another winner for appreciating him :)

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

      @@keerthi1070 you are another winner for appreciating another winner

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

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

    • @ldar6472
      @ldar6472 3 роки тому +8

      @@Tetrax this recursive call stack gotta stop somewhere XD

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

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

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

    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

  • @sede189
    @sede189 3 роки тому +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!!!!

  • @yadikishameer9587
    @yadikishameer9587 3 роки тому +10

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

  • @ChillAutos
    @ChillAutos 3 роки тому +18

    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.

  • @harshdhamecha5301
    @harshdhamecha5301 7 місяців тому +2

    I never knew Graphs were that easy!
    You're one of the rarest gems I have come across in my life.
    Followed it all along. Solved all the problems in Python.

  • @MARIUTSKI13897
    @MARIUTSKI13897 3 роки тому +96

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

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

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

  • @Basta11
    @Basta11 2 роки тому +88

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

  • @vinayrajagopal5478
    @vinayrajagopal5478 2 роки тому +34

    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 2 роки тому +1

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

    • @theLowestPointInMyLife
      @theLowestPointInMyLife Рік тому +3

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

  • @johnbell5195
    @johnbell5195 3 роки тому +10

    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 2 роки тому +10

      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 2 роки тому +3

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

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

    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.

  • @saishsankhe
    @saishsankhe Рік тому +7

    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. 👍

  • @Dani-zf7cu
    @Dani-zf7cu 3 місяці тому +1

    Thank you Alvin! I've been trying to grind leetcode and DSA for interviews, and this video as well as your binary trees video was so amazingly helpful and way more efficient than blindly doing problems to help me strengthen the fundamentals, and in particular, I was really struggling with handling how to handle graphs in the form of a matrix rather than an adjacency list -- I typically tried to convert it into an AL unnecessarily, but watching this video, especially the numIslands section, made things just click. You also have given me so much of a better understanding and less fear of recursion, even going to appreciation of recursion! That's crazy.
    Also, for the numIslands problem, to save a bit on space, I got rid of the visited set and just set grid[row][col] == 'V' to mark that it's visited, and only add where grid[row][col] == L. This worked.

  • @bambamgam
    @bambamgam 2 роки тому +2

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

  • @rahul-qo3fi
    @rahul-qo3fi 3 роки тому +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!

  • @kelvinmuza7034
    @kelvinmuza7034 3 роки тому +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

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

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

  • @franklinghosh4317
    @franklinghosh4317 3 роки тому +84

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

    • @AlvintheProgrammer
      @AlvintheProgrammer 3 роки тому +13

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

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

      @@AlvintheProgrammer what next ?

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

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

    • @AlvintheProgrammer
      @AlvintheProgrammer 3 роки тому +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.

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

    This is an incredibly straight forward and simple to understand graph video. This video definitely made me clean up rough edges in my understanding of tackling graph DSA problems. Thank you !!

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

    50 mins in and THIS IS THE BEST VIDEO ON THE INTERNET handsdown!!
    Thank you so much

  • @Emanuel-yb3qk
    @Emanuel-yb3qk 3 місяці тому +1

    Best teacher ever. Thanks for this.

  • @adityabyreddy
    @adityabyreddy 2 роки тому +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
    }

  • @zeryabalam7042
    @zeryabalam7042 3 роки тому +20

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

  • @Rajansippy1
    @Rajansippy1 3 роки тому +3

    Thanks

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

    Thanks again, from Brazil! ❤

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

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

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

    Just for correction, Islands count problem, inside DFS function for checking boundaries, for 'j' check for j < grid[0].length, because if in NxM grid N !== M, in that case j < grid.length cannot check for true boundary and result will be wrong, I just wanna mention that in case

  • @ohmegatech666
    @ohmegatech666 4 місяці тому +1

    I was confused when you started going through depth first search because you put both of A's neighbors B and C on the stack which seems to be breadth first. But what helped me to understand is the fact that the loop starts when we pop a node from the stack, not when we add it to the stack. The stack doesn't represent which node we are currently "at", the node we pop from the stack does that. The stack is just an in between step. So we don't actually "go to" C at first, we just add it to the stack for now. We do "go to" B because we pop it from the stack

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

    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

  • @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!

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

    Best explanation I ever watched in UA-cam. You deserve a thumbs up and a comment from a laziest person on earth!

  • @alessiocelentano6895
    @alessiocelentano6895 3 роки тому +5

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

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

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

  • @OEThe11
    @OEThe11 2 роки тому +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.

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

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

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

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

  • @punith023
    @punith023 3 роки тому +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!

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

    I am currently struggling with studying graphs, and you are my savior.

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

    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.

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

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

  • @bikkikumarsha
    @bikkikumarsha 2 роки тому +2

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

  • @harsha1883
    @harsha1883 8 місяців тому +3

    Here are the leetcode equivalent questions:
    has path/ undirected path - 1971. Find if Path Exists in Graph
    connected components - 323. Number of Connected Components in an Undirected Graph
    island count - 200. Number of Islands
    minIsland - 695. Max Area of Island

  • @Website_TV_1
    @Website_TV_1 4 місяці тому +1

    I like his lecture, learn a lots, thanks man.

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

    I think this should be the first programming video anyone watches , I was struggling so hard before this

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

    This course was incredibly helpful and so well done. Thanks so much! Alvin, you're a phenomenal teacher!!

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

    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!

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

    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

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

    34:29 for anyone confused here, the graph in the example given is incorrect. number of edges is not n^2. To show a graph with n^2 edges each node needs to point to every other node AND also point to itself

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

    Extremely high quality presentation! Well done

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

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

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

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

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

    great video, but i have a minor comment
    at 1:00:34, look at the hasPath function, i would swab the first 2 lines (line 7 and 8), which represent our 2 atomic cases, this way you can use the function to check whether there is a path from src to dst that does not pass through node x, or nodes {x, y, z}
    by calling the function with the visited set already populated with the nodes you want to exclude, this would not work with the current implementation but it still works fine

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

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

  • @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.

  • @pandeyaashish6544
    @pandeyaashish6544 2 роки тому +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 ❤️

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

    Just have to agree with others that this is one of if not the best course on graph problems out there. Like many, I was intimidated by graph problems early on but this video has made me so much more comfortable with them. I feel like I actually understand them at a deep level now.

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

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

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

    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

  • @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

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

    just wow on the fact that we're living in a world where we have access to such a quality learning material for FREE. Thanks a lot!!

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

    by far the best explanation of dfs and bfs that actually makes sense!

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

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

  • @Sean-gx1sf
    @Sean-gx1sf 2 роки тому

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

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

    Quick observation on the Nondirected - Has Path problem:
    Before that, Alvin, you are a genius man! You make everything sooo easy B)
    Ok here it goes:
    At around 59:00 you are using a set to keep track of visited nodes and returning false as soon as you find the source element in the set. I feel you are missing an edge case here.
    Imagine a graph in the shape of a Kite 🪁🪁🪁🪁 --> A cycle on top and a tail just below the cycle. The cycle and the tail are one single graph.
    Let us say the cycle starts at node a (a - b - c - a) and the tail (a - m - n - o). I want to find a path between (b and o)
    We need to to track the remaining nodes of the graph, because, without it, the process will start from a and take a trip through the cycle and come back to a; this already exists in set at this point in execution, the function returns false without checking the tail section of the Kite Shaped Graph.

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

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

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

    Learning this to win a coding competition. If I reply to this thread on the 28th of this month, it's good news! Wish me luck🙏

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

      I am guessing that's not a good news! Hope you are doing well.

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

    ¡Gracias!

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

    this guy is the best teacher there is.
    Thank you so much!
    I have subscribed to your chanel (:

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

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

  • @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

  • @avitwito1734
    @avitwito1734 4 місяці тому +1

    amazing tutor, The best I've seen

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

    One issue in the shortest path, 1:36:16 , its that whenever you find the destination you always return it. Its not always the shortest path.
    You can maintain a min counter to maintain the shortest distance.
    Also thanks for the wonderful video, just by following the videos , I could do the implementation on my own

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

      I think that would have been an issue if we were using DFS, considering the nature of BFS and visited set that we are using, whenever we find the destination, that path will always be the shortest.

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

      @@siddhantgupta4295 correct, thanks for the detailed explaination. I came to know about this after doing many bfs problems. I dont knw if it was mentioned in this video, if not then it should be mentioned :) happy coding

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

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

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

    You just made me crack my Interview on graph algorithms... and I have just seen half the video only to make it... Thanks a ton Bro... Let me complete this

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

    number islands problem couldnt have been solved easier than this, kudos to this guy! for once i was able to understand the solution and complete the problem without errors.

  • @VinodKumar-wh1mq
    @VinodKumar-wh1mq 3 роки тому +3

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

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

    For the island count problem, i ended up converting the entire 2D grid into a graph containing only 'L' nodes with multiple components. I then did a dfs for each of those islands, incrementing a counter everytime i finished exploring one of them and adding it to my visited set. Really interesting how you can solve this problem in such a different way!

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

      Nice try. You converted the problem to components based & followed his components count approach.

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

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

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

    I was quite struggling with problems when I realized my conception isn't clear. I can't thank you enough for this explanation.

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

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

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

    Hats off FCC and Alvin. Whenever I see your videos I also get the feeling that I should give back to the awesome community this is .

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

    For largest component problem , there can be an easy and alternate solution . Since , we already have visited which is keeping track of all nodes. There is no need to maintain separate "size". Below is the code you can use to your advantage:
    const largestComponent = (graph) => {
    let maxSize = 0;
    let previousVisitedSize = 0;
    let actualSize = 0;
    const visited = new Set();
    for(const node in graph) {
    if(explore(graph, node, visited) === true) {
    actualSize = visited.size - previousVisitedSize;
    maxSize = Math.max(actualSize, maxSize);
    previousVisitedSize = visited.size;
    }
    }
    return maxSize;
    };
    const explore = (graph, node, visited) => {
    if(visited.has(String(node))) return false;
    visited.add(String(node));
    for(const neighbor of graph[node]) {
    explore(graph, neighbor, visited)
    }
    return true;
    }

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

    The series of your videos are amazing. They are the best courses I have ever seen regarding data structure and algorithm studies. However, I do think I find out a potential mistake. At 1:53:55, check the line 12, const colInbounds = 0

  • @mandihaase2744
    @mandihaase2744 3 роки тому +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!

  • @Kidkromechan
    @Kidkromechan 2 роки тому +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.

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

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

  • @thewildweb
    @thewildweb 4 місяці тому +1

    This is really a damn refresher

  • @jrumac
    @jrumac 7 місяців тому +2

    Alvin is single-handedly going to take me to the promised land. Love you Alvz

  • @chaitanyashahare2734
    @chaitanyashahare2734 6 місяців тому +2

    This video is game changer!!