Heaps & Priority Queues

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ก.ย. 2024

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

  • @yevgeniyv.87
    @yevgeniyv.87 6 ปีที่แล้ว +39

    This was an amazing explanation. So much better than the hackerrank video. Thank you!!!

  • @user-wy7wl5on7l
    @user-wy7wl5on7l 2 ปีที่แล้ว +2

    It's funny, despite being at a top 3 institution I still keep coming back to your videos. They are easily the best of their category on youtube.

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

      Thank you so much for the comment! It's great to hear the work we do is useful.

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

    Best explanation of heaps + priority queues on TH-cam. Clear and precise explanation. 👍

  • @RaselAhmed-jc6iu
    @RaselAhmed-jc6iu 5 ปีที่แล้ว +26

    You can also do 2i+1 for left child and 2i+2, starting from index 0.

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

      To help anyone else out, to get the parent in the above method is parent = floor((i-1) / 2).

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

      Yes this is how i learned it

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

    This is a great explanation. Deserves more likes!

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

    Excellent explanation. Thanks for making this! Especially thanks for explaining the math behind the parent/child relationship and why starting with Index 1 is recommended.

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

    Great job doing this lesson. Understood pretty much anything - big thanks to you!

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

    Wow, I am so surprised how clear this video is! It is really good! Thank you!

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

    Best tutorial on this topic! Subscribed

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

    very good explanation

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

    Really good explanation;)
    Jst enjoyed it..

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

    What a great and clear lesson. Thank you, sir.

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

    very good course about data structures

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

    Truely great lession , thank a billion , looking forward for more vedios on data structures and algorithems ... you rocks sir ...thanks again , keep up good work...

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

    Awesome explanation. Thank you sir.

  • @GauravSingh-ku5xy
    @GauravSingh-ku5xy 2 ปีที่แล้ว

    Good explanation man.

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

    Great job.

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

    Great explenation!!

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

    A greeeeaaaat video!!!

  • @gioac96
    @gioac96 5 ปีที่แล้ว

    Very well done video. Thank you!

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

    clear and understood ....thx !

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

    Super thanks a zillion

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

    I saw that you listed under "making a priority queue from a heap is straight forward" the feature to "change priorities" by removing the element and then re-inserting it, do you know why this isn't provided in the standard C++ priority queue? Is it just because there is no way to do this in constant time? (having to search for the element to remove, and then reinsert)

  • @rahul-patil
    @rahul-patil 4 ปีที่แล้ว

    Thanks

  • @user-hb8xk9io1o
    @user-hb8xk9io1o 4 ปีที่แล้ว

    magnificent

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

    In the array values, why does 5 comes before 7 and 2 before 3, 4 and 1?

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

    When you restore the max-heap order by swapping, is this heapify?

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

    So with a max-heap, my uncle can be younger than me.

  • @OmarOmar-eo3pw
    @OmarOmar-eo3pw 5 ปีที่แล้ว

    Isn't priority queue an ADT implemented with heap and not a data structure in and of itself? from the video intro.

  • @SpiritOfIndiaaa
    @SpiritOfIndiaaa 6 ปีที่แล้ว

    what happend when we try to insert the same element twice ? please explain in detail?

    • @NatureCuts
      @NatureCuts 5 ปีที่แล้ว

      the second element will have less priority because it was added in after, it will be treated like a regular queue, first in first out.

  • @farmakoxeris
    @farmakoxeris 6 ปีที่แล้ว

    What Happens if each number has a different number of childs?

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

      That would not be a binary tree so nothing from this video would apply.

  • @abdelrhmanahmed1378
    @abdelrhmanahmed1378 6 ปีที่แล้ว

    but 2 is child of 8 and 6 is grandchild of 8 also but they arenot arrange well

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

      It doesn't matter, the heap condition is satisfied. Every children is smaller than it's parent and the largest element is in the root of the heap.

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

    7:37 is impossible. So it is not a very good make up example.

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

    This is a great explanation. Deserves more likes!