(Remade) Dijkstra's Algorithm | BFS | Network Delay Time | Leetcode 743

Sdílet
Vložit
  • čas přidán 22. 04. 2020
  • Topic: Dijkstra | Breadth First Search
    Time Complexity: O(ElogE)
    Space Complexity: O(V + E)
    Code:
    github.com/Nideesh1/Algo/blob...
    Leetcode:
    leetcode.com/problems/network...
    Note I claim no rights to this question. All rights belong to Leetcode. If I'm reviewing a solution that was from another Leetcode user or Leetcode itself I will give credit below.
    Credit to : Leetcode Solution | leetcode.com/problems/network...
    A fantastic tool to help visualize algorithms: algorithm-visualizer.org/
    Their github link: github.com/algorithm-visualiz...
    Hey there! Just wanted to let you know that some of the below links in this video description are affiliate links, which means that if you make a purchase through them, I may earn a small commission. Don't worry though, it doesn't cost you anything extra and it helps support this channel so I can continue to make more videos for you. Thank you so much for your support, and as always, all opinions are my own!
    Start getting great at system design: bytebytego.com?fpr=nideesh (affiliate link)
    Handpicked Algorithms and Data Structures for Interview To Save Time: interviewpen.com/?via=nideesh (affiliate link)
    Fast track to becoming a knowledgeable SWE www.educative.io/unlimited?af... (affiliate link)

Komentáře • 20

  • @kangniliu7992
    @kangniliu7992 Před 4 lety +4

    Thanks for your videos! Just want other viewers to know that there is no need to compare the res with Math.max, because pq polls all possible distances strictly from the smallest to the biggest. So each time you update res, res would be bigger. And in the end, res would be automatically the biggest, which is the longest time you need to access all nodes ;)

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

    0:00 Outline
    0:21 Input/Output
    1:39 BFS vs Dijkstra
    4:38 Dry Run
    8:34 Algo Visualizer
    9:00 Code
    11:20 Time/Space Complexity
    I made a mistake by writing 742 on the top, I meant to write 743
    Hey there! Just wanted to let you know that some of the links in this comment are affiliate links, which means that if you make a purchase through them, I may earn a small commission. Don't worry though, it doesn't cost you anything extra and it helps support this channel so I can continue to make more videos for you. Thank you so much for your support, and as always, all opinions are my own!
    Start getting great at system design: bytebytego.com?fpr=nideesh (affiliate link)
    Handpicked Algorithms and Data Structures for Interview To Save Time: interviewpen.com/?via=nideesh (affiliate link)
    Fast track to becoming a knowledgeable SWE www.educative.io/unlimited?aff=K1z6 (affiliate link)

  • @Nickel80
    @Nickel80 Před 4 lety

    Great video, please keep up the good work. The animation in the end was good.

  • @abhinavsinghal1530
    @abhinavsinghal1530 Před 3 lety

    amazing video bro!! Cleared all the confusions and made it so much more inuitive

  • @chepaiytrath
    @chepaiytrath Před 3 lety

    Great explanation. I could visualize the whole thing easily.

  • @prashantkadam9533
    @prashantkadam9533 Před 4 lety

    Great Video Nideesh ..

  • @karankanchetty105
    @karankanchetty105 Před 4 lety

    Awesome man. Great video.

  • @techgianttechyforever
    @techgianttechyforever Před 3 lety

    nice brother,keep it up

  • @nathanielgoodman2466
    @nathanielgoodman2466 Před 4 lety

    Excellent video

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

    Keep up good work

  • @mangeshshikrodkar6192
    @mangeshshikrodkar6192 Před 4 lety

    very nice

  • @kirtanitaliya7631
    @kirtanitaliya7631 Před 4 lety

    increase font size on white board. It is hard to read even in HD

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

    I think
    dist.put(K, 0); // should be commented. and also

    max = Math.max(max, dis); // should go after `if (dist.containsKey(node)) {continue;}` and before `if (adj.containsKey(node))`
    correct me if I'm wrong

    • @MohanRaj-vp1zt
      @MohanRaj-vp1zt Před 4 lety

      You are correct, bug in the code. But the nonetheless, its a good video.

    • @EaimanShoshi
      @EaimanShoshi Před 4 lety

      @@MohanRaj-vp1zt obviously you are also correct

  • @satishshingade8514
    @satishshingade8514 Před 3 lety

    are you indian ?? but you don't sound like indian .. very different accent

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

      Yes I'm Indian 100%! I sound like this cause I grew up in America