Heaps in 6 minutes — Methods
68,423
Published 2022-07-06
Code: github.com/msambol/dsa/blob/master/data_structures…
Heap sort code: github.com/msambol/youtube/blob/master/sort/heap_s…
Source: Introduction To Algorithms, Third Edition (CLRS) [www.amazon.com/Introduction-Algorithms-3rd-MIT-Pre…]
LinkedIn: www.linkedin.com/in/michael-sambol
All Comments (21)
-
The "height of binary tree" slide should read "height of nearly complete binary tree." Regular binary trees may become unbalanced and thus not have a height of O(logn). Because heaps are nearly complete binary trees (which are balanced), we know that the height is O(logn).
-
If you are reading this comment, I would like to say thank you for your educational content. You helped me pass Algorithms with a grade of B.
-
Micheal is singlehandedly helping every single computer science student pass this exam
-
Love your videos. Short, clear, and no frills.
-
You always makes things clear
-
Amazing! Very straight to the point
-
Bro, really thanks to give so clean a very good explained things, you're literally save my life
-
Absolutely appreciate your visual explanations!!!
-
I really enjoy the bite sized nature of your videos It really helps me understand the concept, and I then know about it for future research if need be Thanks a lot for your content
-
Thanks! Very useful video, it clarified some things for me
-
It was very helpful. thanks!!
-
It would be great if you can also show methods for adding elements into the heap and removing them and the complexities involved there. Thanks!
-
I don’t understand why build max heap is not nlogn in run time since u run max heapify on n nodes
-
ur video is awesome!
-
typo at 5:01 last line is max_heapify(a, 5, i) instead it should be max_heapify(a, 10, i)
-
whats the purpose of l<heap_size t 3:16 . Also what's the difference between max_heapify and build_max_heap ?
-
Hey Michael! What a great video! This six minute video actually took me a few hours to really gain understanding. :D QQ: You state at 5:29 that the run time is O(n) but in each iteration of the for loop you call max_heapify which has a run time of log(n). Being that, shouldn't the runtime be 0(n * log(n))? Thank you?
-
just a little doubt, in maxheapify shouldnt it be if l
a[largest] -
Oh yeah, another addition to collection of golden clasics
-
I think there is a mistake at 3:24, for 9 to float down we need to keep using i in the recursive max_heapify, not the largest which is now 18