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.
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...
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)
This was an amazing explanation. So much better than the hackerrank video. Thank you!!!
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.
Thank you so much for the comment! It's great to hear the work we do is useful.
You can also do 2i+1 for left child and 2i+2, starting from index 0.
To help anyone else out, to get the parent in the above method is parent = floor((i-1) / 2).
Yes this is how i learned it
Great job doing this lesson. Understood pretty much anything - big thanks to you!
Best explanation of heaps + priority queues on UA-cam. Clear and precise explanation. 👍
Glad it helped!
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.
You're welcome!
Really good explanation;)
Jst enjoyed it..
This is a great explanation. Deserves more likes!
very good explanation
very good course about data structures
Wow, I am so surprised how clear this video is! It is really good! Thank you!
Glad it was helpful!
Best tutorial on this topic! Subscribed
Awesome explanation. Thank you sir.
Thanks and welcome!
What a great and clear lesson. Thank you, sir.
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...
Good explanation man.
Thanks so much!
Very well done video. Thank you!
Great job.
Great explenation!!
In the array values, why does 5 comes before 7 and 2 before 3, 4 and 1?
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)
clear and understood ....thx !
When you restore the max-heap order by swapping, is this heapify?
Super thanks a zillion
Thanks
magnificent
Isn't priority queue an ADT implemented with heap and not a data structure in and of itself? from the video intro.
yes
what happend when we try to insert the same element twice ? please explain in detail?
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.
What Happens if each number has a different number of childs?
That would not be a binary tree so nothing from this video would apply.
but 2 is child of 8 and 6 is grandchild of 8 also but they arenot arrange well
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.
So with a max-heap, my uncle can be younger than me.
7:37 is impossible. So it is not a very good make up example.
This is a great explanation. Deserves more likes!