Heap Explained - Algorithms & Data Structures #20

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ต.ค. 2024

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

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

    Thank you so much! You teach better than my teacher who has a degree in computer science!

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

    Very very thanks man.. I checked so many videos but this one most clear one.

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

    Thank you! Amazing introduction, very visual and easy to comprehend!

  • @laijie9866
    @laijie9866 7 หลายเดือนก่อน +1

    Just found out that in the "Competitive Programming Book" Ed. 4, in order to explain the Priority Queue, they used the same example Heap as you xd

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

    Incredibly helpful, thanks!

  • @Marwan-oh4tk
    @Marwan-oh4tk 9 หลายเดือนก่อน

    Thank you, your explanations were very useful.

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

    You teach better than my professor !

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

    4:37
    Question - how do you find the lowest, available node of the tree, where you should insert the data? It seems simple enough to do if one has implemented the heap with a normal list, in that case you would literally just pick the last spot in the last, but if you're using an actual tree structure it seems to be a bit more difficult. The only obvious way I can think of would be to recursively search through the tree, until you find the correct spot, or maintaining some counter of where the lowest spot is. Both of those seem rather clunky, though. You'd think That there should be some simple and quick way to find the last spot of the tree

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

      I also thought of BFS traversal (go while left and right children of current node are populated, and if not - populate with new value)

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

    Awesome video. Please make a series of C language

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

    First of all, I am 1/3 through. Thanks for making this. So a Binary Tree is good for only popping the ‚most important‘ node first and then retrieving the next? Am I correct to assume its not designed to be searched for values since you said left child may be greater than right child and vice versa so its unclear which path to follow to retrieve a target value.

  • @vineetbhat9731
    @vineetbhat9731 4 ปีที่แล้ว

    Thanks for the video. I had few questions. For Heapify-Up, a complexity of log(n) makes sense to me because we just compare with the immediate parent. But for Heapify-Down, before making comparison with the immediate child, we need to first find the largest child, which I think is another comparison. So how is the complexity still log(n) ?
    Also, am I correct when I say that both enqueue & dequeue operations occur in log(n) time ?

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

      Just because you always do two comparisons instead of one, doesn't mean that you change the runtime complexity. Two is a constant number. Even if you had 1000 comparisons for each level it would still be logarithmic.

    • @vineetbhat9731
      @vineetbhat9731 4 ปีที่แล้ว

      @@NeuralNine Oh yes! Now it makes sense. Thanks a lot.

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

    love your vids

    • @NeuralNine
      @NeuralNine  4 ปีที่แล้ว

      appreciate it :)

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

    thanks for the explaination and great fucking arms brother!

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

    The binary tree is highly politically charged, each child has a left and a right, which in turn have also a left and a right... Dialectic ultra level.

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

    Adorable 😍

  • @neelaynaman6481
    @neelaynaman6481 3 ปีที่แล้ว

    what's the into music