Heap - Max Heapify

  Рет қаралды 213,638

zooce

zooce

Күн бұрын

Пікірлер: 88
@Alicia0Cramel
@Alicia0Cramel 5 жыл бұрын
Thank u god all mighty i couldn't find a SINGLE video to explain this concept quickly and concisely omg!!
@dariuszd6207
@dariuszd6207 5 жыл бұрын
It was hard to find simple and clear explanation of this problem. Thank you.
@kimberlyjohnson2580
@kimberlyjohnson2580 8 жыл бұрын
This made so much sense! Thank you for explaining it so clearly!
@MarsTheProgrammer
@MarsTheProgrammer 9 жыл бұрын
Thanks buddy, you explained it and made it clearer than my professor who has 2 Phds...
@heatxtm
@heatxtm 7 жыл бұрын
well, having 2 Phds doesn't mean anything one thing is to know something (2 Phds says that) and other thing is to teach or explain
@dghthh2163
@dghthh2163 7 жыл бұрын
A phd is not a job training for teachers.
@kadentaylor8503
@kadentaylor8503 5 жыл бұрын
@@dghthh2163 LOUDER FOR THE FOLKS IN THE BACK!
@AlexChambersXYZ
@AlexChambersXYZ 10 жыл бұрын
I call you "Zeus" god of the algorithms ruler of data structures thanks man.
@HaloElite
@HaloElite 8 жыл бұрын
I love you so much for creating this video! Saved my life!
@bobbymcgrath8025
@bobbymcgrath8025 4 жыл бұрын
Very well explained video and the visual representation was very well illustrated and broken down into a step-by-step formula that made it even easier to understand, thank you sir! :)
@Shobu
@Shobu 7 жыл бұрын
much love man. my teacher is a 70 years old who it does not care about students. Thanks a lot !
@botqqq
@botqqq 6 жыл бұрын
Perfect and simple explanation. Thank you!
@KnownUser139
@KnownUser139 8 жыл бұрын
I think this guy was sick too..Hats off to you it was a great video
@Burak-pl1jl
@Burak-pl1jl 7 жыл бұрын
Brief and understandable explanation! Thank you. :)
@MorleyDev
@MorleyDev 9 жыл бұрын
Is there a particular reason you traverse the tree starting with the right subtree of 16 first on your tree at 2:00? I thought tree traversals (pre-order, post-order, in-order) put left before right in all cases?
@Z00CE
@Z00CE 9 жыл бұрын
Nathan Morley, good question. A heap is not like a binary search tree, where pre/post/in-order traversals are useful. When we begin to heapify, we have to start from the very last subtree which starts at the floor(N/2) "root". Remember that when we build a heap, we insert from top to bottom, left to right, that way the tree stays nearly complete, so if we didn't have the last two nodes, we would have started from that left subtree at the bottom. I hope this makes sense...if not, let me know and I can explain further. Thanks for watching!
@ExploreWithNam
@ExploreWithNam 7 жыл бұрын
Could you please explain how to compute time complexity for this?
@MyVanir
@MyVanir 5 жыл бұрын
Great explanation, helped me a good bit.
@DrakeLuce
@DrakeLuce 7 жыл бұрын
Basically a Khan Academy video. Great job :)
@RafaelNascimento-qo1jp
@RafaelNascimento-qo1jp 4 жыл бұрын
6 minutes of "visualization" is worth more than 6 hours of explanation
@minkihairoil
@minkihairoil 3 жыл бұрын
Thank you so much this FINALLY makes sense :))
@devinj374
@devinj374 Жыл бұрын
fantastic video!
@向前走五十五步
@向前走五十五步 6 жыл бұрын
Super clear. Thank you for the posting.
@vijaydulam5886
@vijaydulam5886 10 жыл бұрын
Awesome Sir ! clear This Topics
@CloudStrife0896
@CloudStrife0896 5 жыл бұрын
Simple as 1-2-3, good job on explaining another thing not done right in Greek universities.
@Simoky99
@Simoky99 5 жыл бұрын
or in brazilian universities
@teeheeee7807
@teeheeee7807 8 ай бұрын
Thank u so much it helps a lot 💗
@אלעדשגיב
@אלעדשגיב 4 жыл бұрын
It was a perfect explanation , thank you!
@jontran3194
@jontran3194 7 жыл бұрын
I dont get it. If this is big O(logN) Everytime you max heap something. You mess up the sub tree below. So you have to go back and max heap it again. Isn't it O(n^2)?
@kendellferguson5021
@kendellferguson5021 2 жыл бұрын
Who knew Ben Shapiro would be teaching me Data Structures lol Great Video btw
@diana-hus
@diana-hus 3 жыл бұрын
Thank you! It was extremely helpful
@saxophone12player
@saxophone12player 10 жыл бұрын
Thanks man !
@coyotulnegru
@coyotulnegru Жыл бұрын
thank you mister
@chagantirbbsrao5930
@chagantirbbsrao5930 4 жыл бұрын
great work!! thanks
@ericknicolasnunesdahora4860
@ericknicolasnunesdahora4860 7 жыл бұрын
Thank you sir!
@elyartaker1139
@elyartaker1139 22 күн бұрын
wow thank you for this
@minhhuynh2646
@minhhuynh2646 4 жыл бұрын
Thank you man you are great
@transam351
@transam351 8 жыл бұрын
How does the algorithm know when it needs to re-heapify subtrees?
@Z00CE
@Z00CE 8 жыл бұрын
It always checks the subtree which it swapped with. If that subtree is a max heap (i.e. the child nodes of that subtree are less than the new parent) then it doesn't need to heapify that subtree, otherwise it will re-heapify it, and so on.
@prof.dalmar6989
@prof.dalmar6989 8 жыл бұрын
Grt video thanks sir now i understand clearly thnx
@yongkailiu1448
@yongkailiu1448 5 жыл бұрын
Really helpful!!!
@VersatileAnthem
@VersatileAnthem 5 жыл бұрын
yeah i understood but how to make that understandable to computer
@romansmirnov3351
@romansmirnov3351 8 жыл бұрын
thanks man, that was good
@batuhanbayr7613
@batuhanbayr7613 Жыл бұрын
KZbin AWARDS GOES TO..
@tusharpandey6584
@tusharpandey6584 4 жыл бұрын
very nice explanation thanks
@Simoky99
@Simoky99 5 жыл бұрын
I finally understood this crap. thanks
@deepakrout6795
@deepakrout6795 4 жыл бұрын
Which drawing app are you using for lecture?
@43_ayonroy4
@43_ayonroy4 2 жыл бұрын
I have to submit an assignment tomorrow but I also have an exam on the same day. I need help
@ashitpanda2905
@ashitpanda2905 8 жыл бұрын
Ahh thanks for this video. But i must say it could have great if you had described with the algorithm description.
@vikasyadav-og2cg
@vikasyadav-og2cg 7 жыл бұрын
sir if value is 23 in the place of 5 what should i do???, which value can be swapped???
@lamyagawdat9203
@lamyagawdat9203 5 жыл бұрын
god bless you buddy
@natsuvatsan6108
@natsuvatsan6108 2 жыл бұрын
What about min heap?
@haisulii
@haisulii 5 жыл бұрын
Simple to understand.
@persianshawn92
@persianshawn92 6 жыл бұрын
so when we go through each subtree, we always go from right to left?
@jonasgrnbek7113
@jonasgrnbek7113 4 жыл бұрын
What software is used to create this?
@Aevatheone
@Aevatheone 7 жыл бұрын
Awesome! :D
@karolkarol1430
@karolkarol1430 7 жыл бұрын
Thank you a lot ;)
@akashaggarwal3382
@akashaggarwal3382 8 жыл бұрын
grt video
@JananiAnbarasan
@JananiAnbarasan 6 жыл бұрын
what tool/software do u use to write?
@leadguitar53
@leadguitar53 5 жыл бұрын
Isnt subtree 2 still unfinished at the end of the video?
@darshfify
@darshfify 10 жыл бұрын
thank you :)
@elie3423
@elie3423 6 жыл бұрын
not indian: check clear voice: check good video quality: check knows what he is doing: check Thanks bro for the perfect video
@KyleBridenstine
@KyleBridenstine 10 жыл бұрын
On the third sub-tree where both child nodes are greater than the parent, for some reason I always thought you start with the left child and swap those then you evaluate the right child and if the rights larger you swap those, I didn't know you just pick the one that's the largest :0
@Z00CE
@Z00CE 10 жыл бұрын
If you took that approach (starting by swapping with the left child) you'd be adding quite a bit of extra, unnecessary computation. Heapify is recursive, so when you swap, you Heapify the subtree that you just swapped with...thus you'd have to come back up to the initial subtree after who knows how many Heapify's of that left subtree, then swap with the right child, and recursively Heapify the right subtree. (Sorry you might have to read that a couple of times...lots of "subtrees" and "Heapify's") I realize that it's difficult to visualize this with the example in the video, but if your Max-Heap was very large, you could see just how much extra work you cut out by simply swapping with the larger of the two. Hope that helps clear things up. Thanks for watching!
@KyleBridenstine
@KyleBridenstine 10 жыл бұрын
Yeah I thought about that as soon as I saw this video it definitely makes sense this way! Wish me luck on my final tomorrow :(
@Z00CE
@Z00CE 10 жыл бұрын
Awesome! Good luck!
@fog1257
@fog1257 Жыл бұрын
Thanks!
@mohammadishaqnoori9728
@mohammadishaqnoori9728 7 жыл бұрын
thank you Sir
@Alex-ii3me
@Alex-ii3me 3 жыл бұрын
Thanks!!!
@cav3man82
@cav3man82 8 жыл бұрын
didn't you just go through the whole build heap function (and not just max-heapify on a particular node)?
@Z00CE
@Z00CE 8 жыл бұрын
Yep
@elliotgehin
@elliotgehin 9 жыл бұрын
Cheers m'dears
@abdulmalikjahar-al-buhairi9754
@abdulmalikjahar-al-buhairi9754 5 жыл бұрын
HEEELP I UNDERSTAND THIS BUT I HAVE PSEUDO CODE THAT DOES THIS TOP DOWN! Why would you do that to me prof?! Isnt it stupid to go top down? You have to make redundant checks? Or doesnt it matter?
@qwertek8413
@qwertek8413 Жыл бұрын
thanks ;)
@Lukas-bb4sg
@Lukas-bb4sg Жыл бұрын
Thanks
@nishantingle1438
@nishantingle1438 5 жыл бұрын
Someone please give me iterative code for max heapify.
@allenyin7630
@allenyin7630 6 жыл бұрын
A binary heap is not nearly a complete binary tree. It is a complete binary tree.
@MaleeshaHuththo
@MaleeshaHuththo 3 жыл бұрын
Ben Shapiro before he was famous. jokes aside, this was very informative.
@zilinli187
@zilinli187 4 жыл бұрын
save my life for only 6min
@ORagnar
@ORagnar 4 жыл бұрын
So, you are pushing the maximum value to the top by this method.
@Z00CE
@Z00CE 4 жыл бұрын
Yep, that's correct. And to be even more correct, every "parent" value is greater than (or equal to) it's "child" values.
@pranupranav5563
@pranupranav5563 6 жыл бұрын
NIce
@jortvincenti7831
@jortvincenti7831 4 жыл бұрын
t'es un bro
@Bbehemothh
@Bbehemothh 4 жыл бұрын
At 1.5x you sound like Ben Shapiro.
@dinhomhm
@dinhomhm 4 жыл бұрын
thank you sir
Heap - Build Max Heap
6:10
zooce
Рет қаралды 369 М.
3 Types of Algorithms Every Programmer Needs to Know
13:12
ForrestKnight
Рет қаралды 525 М.
How to have fun with a child 🤣 Food wrap frame! #shorts
0:21
BadaBOOM!
Рет қаралды 17 МЛН
Thank you mommy 😊💝 #shorts
0:24
5-Minute Crafts HOUSE
Рет қаралды 33 МЛН
Jennifer Burns - The Truth About Milton Friedman
12:18
Liberty Vault
Рет қаралды 2,3 М.
2.6.3 Heap - Heap Sort - Heapify - Priority Queues
51:08
Abdul Bari
Рет қаралды 2,3 МЛН
The hidden beauty of the A* algorithm
19:22
Polylog
Рет қаралды 922 М.
Graphs - Depth First Search
6:25
zooce
Рет қаралды 36 М.
Introduction to Binary Heaps (MaxHeaps)
9:47
Algorithms with Attitude
Рет қаралды 212 М.
Binary Heap - Insert, Sift Up, Delete, Sift Down, Heapify(BuildHeap)
23:06
Heaps in 6 minutes - Methods
5:56
Michael Sambol
Рет қаралды 95 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 779 М.
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 691 М.