Master Data Structures & Algorithms For FREE at AlgoMap.io!
@Brusselsprouts202325 күн бұрын
wow! This channel is so underrated. Thankyou!!
@steventolerhan51103 ай бұрын
Best video on heaps on youtube fr fr
@sonhoang8986Ай бұрын
Thank you for your explanation. I love how you explain the theory, but I expected more about the coding section. I hope something from scratch to understand the theory. Anw, thank you so much
@TaskForce141br2 күн бұрын
On the pop is important that you substitute the top element by the rightmost element on the heap, that way you maintain the balance property of the heap, after that you heapify down. The way it was presented may cause confusion, beacause if you just remove the element on the top and do the rearranjement, the heap may become unbalanced
@kapilrules3 ай бұрын
thank you man to negate the values to use it as max heap was awesome trick ❤❤❤
@GregHogg3 ай бұрын
Yeah I found that very cool when I first learned it too
@Jay-ek7uw4 ай бұрын
These videos are great. Much love Greg
@jingwen888wang14 күн бұрын
The pop heap described h err e is incorrect, as it does not maintain the heap property which has the has the leaf nodes filled from left, so it messes up the array structure essentially, please pay attention to the details and correct it if it causes confusions.
@adventurer2395Ай бұрын
0:15 bro hitting puberty lol. Great video, well explained
@Emivvvvv29 күн бұрын
looool 😂
@karamalrasam16062 ай бұрын
thank you so much for your clear explaination👍👍
@ahmedzz47544 ай бұрын
Can't wait to see the dp or backtracking lesson (my national programming contest is soon and I suck a both)
@phaseyon582529 күн бұрын
how was it
@Abzal-pd9ri4 ай бұрын
Thank you a lot !! Please more videos like that
@ibraheem_Zain4 ай бұрын
that was very helpful and clear thanks man you really great ♡♡
@GregHogg4 ай бұрын
Glad to hear it, thanks so much!
@leandrormor4 ай бұрын
thanks for sharing your view, i appreciate it
@GregHogg4 ай бұрын
You're very welcome!
@leandrormor4 ай бұрын
not your view, but your way of teaching
@garythegoat8341Ай бұрын
What would happen if that -10 was a leaf node when you were heapifying the min heap? The leaf nodes were ignored but presumably in that case that -10 would need to get to the top?
@gaberhassan3972Ай бұрын
very nice,👌👌👌👌 Thanks
@floccinau2634 ай бұрын
I feel so bad about watching this great DSA lesson for free so even though I have access to Wi-Fi, I use my mobile data instead. (This won't help you in any way either haha TT) My daily DSA teacher Greg ^_^b
@WilkinARuiz13 күн бұрын
Would heapq. Be ok to use in a coding interview? Wouldn't they want you to implement the code?
@davenuada5272 ай бұрын
What app do you use to draw on?
@Karandeepsingh-kk2rv4 ай бұрын
Could you do a course on linked lists please?
@asagiai49654 ай бұрын
I'm surprised that idk that heaps and priority queues are same thing. Always thought they are different.
@GregHogg4 ай бұрын
Haha yep!
@godcomplex8251Ай бұрын
Actually I just looked this up in Sedgewick algo book, it says that heap construction is n.log(n)...
@DevendraYadav-pw9vpАй бұрын
you are correct there is mistake just taking the position to correct spot is O(long) and for this to all n will extend the overall complexity to O(nlogn)
@godcomplex8251Ай бұрын
@GregHogg Love your videos but you should really correct or address mistakes like this, otherwise this can affect your credibility...
@devshah66344 ай бұрын
23:45 You said the heap is set according to the smallest frequency. So why is (3,4) placed after (4,5) in the heap array? PS: Started watching this course recently, loving it so far!
@raafayhemani20183 ай бұрын
The heap array is an array representation of a tree, if you wanted to get them in order you'd do a heapsort
@navneetkumar93773 ай бұрын
Quick question : How are you able to print the trees beautifully at 14:47 ? I can't find any inbuilt function.
@user-jm6gp2qc8x2 ай бұрын
he didn't
@godcomplex8251Ай бұрын
Hey greg, wouldn't the Heapify function be O(n.log(n)), since for every node in the tree of N nodes, you need to perform "Sift down" which itself is O(log(n))?
@sitrucz3 күн бұрын
No look for a proof. O(n)
@atanumaiti163 ай бұрын
when u added 13 to the heap, it violates complete binary tree property.i think it should be added as right child of node 7. same goes with -2.
@sitrucz3 күн бұрын
It’s not a binary tree. Order of children don’t matter.
@dfhg3154 ай бұрын
684. Redundant Connection can u make video on this problem
@asagiai49654 ай бұрын
15:36 I thought heap pop have time complexity of 0(1)? Since you are just popping the minimum or the maximum (depends on what type of heap you have) at the top.
@GregHogg4 ай бұрын
Nope, peek has O(1) but to pop you need to fix the tree which is log n
@asagiai49654 ай бұрын
@GregHogg ok I see there's a difference.
@qulinxao4 ай бұрын
sorry but in "real" pq only one(or zero) node have 1 child - others ether 0 or 2 - it simplifay :)