Heaps & Priority Queues

Поділитися
Вставка
  • Опубліковано 13 жов 2024

КОМЕНТАРІ • 45

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

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

  • @georgegoshanov8329
    @georgegoshanov8329 7 років тому +7

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

  • @umphgoodness
    @umphgoodness 5 років тому +1

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

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

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

    Really good explanation;)
    Jst enjoyed it..

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

    This is a great explanation. Deserves more likes!

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

    very good explanation

  • @stevendeng2758
    @stevendeng2758 4 роки тому +1

    very good course about data structures

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

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

    Awesome explanation. Thank you sir.

  • @xingwuzheng
    @xingwuzheng 6 років тому +1

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

  • @SpiritOfIndiaaa
    @SpiritOfIndiaaa 7 років тому +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...

  • @GauravSingh-ku5xy
    @GauravSingh-ku5xy 2 роки тому

    Good explanation man.

  • @gioac96
    @gioac96 5 років тому

    Very well done video. Thank you!

  • @markkaravan4245
    @markkaravan4245 5 років тому +1

    Great job.

  • @snyderpetitfrere755
    @snyderpetitfrere755 5 років тому +1

    Great explenation!!

  • @meissandoye4500
    @meissandoye4500 4 роки тому

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

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

  • @TheRajo67
    @TheRajo67 7 років тому +1

    clear and understood ....thx !

  • @christoffere425
    @christoffere425 4 роки тому

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

  • @backbencherzgaming7seshasa273
    @backbencherzgaming7seshasa273 6 років тому +2

    Super thanks a zillion

  • @rahul-patil
    @rahul-patil 5 років тому

    Thanks

  • @龙雨-i6o
    @龙雨-i6o 4 роки тому

    magnificent

  • @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 7 років тому

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

    • @NatureCuts
      @NatureCuts 6 років тому

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

    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.

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

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

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