Thank you for this! So many other videos on heaps just speak about the theory, but don't show any implementation or manipulation.
@Gooloso982 жыл бұрын
nice video, remind me of data structures classes. min heap its great and efficient. Usually its implemented on top of arrays, although its best viewed as graphs. min heap always keep a min height state since the height of the tree generated will be log2(numbers inside).
@soufianeaitlhadj91154 ай бұрын
I want just to point out that the heap for a given set of numbers is "NOT" Unique. So you can always predict that if you apply the "heapify()' to the same set of numbers, it can result in different answers.
@AdoptingCode4 ай бұрын
Love the videos. You seem like the guy to ask out of the channels I've watched, and recommendations on ultra learning in terms of python?
@vikasjha10644 ай бұрын
Brilliant mate, ,Please make these type of explanation for other Data Structure also. Thanks
@anthonyrojas99898 ай бұрын
Your videos are awesome, but the music is loud af in the beginning and then the voice audio is way lower. I think that could be better
@rafaelsartoricavalcante425310 ай бұрын
Best video on subject, thanks
@abhishekpardeshi57016 ай бұрын
you did not mention priority queue code
@servantofthelord81474 ай бұрын
Thank you!
@adarshsasidharan254 Жыл бұрын
Brilliant video
@tcgvsocg14582 жыл бұрын
can you do a video on screen recorder but no import with vanilla pyhton please
@takshdhabalia14762 жыл бұрын
Great video Loved the content Keep it up
@disrael21012 жыл бұрын
What for / where it's used for mainly
@jerrylin49802 жыл бұрын
When you need to insert and retrieve multiple times while the order of the list needs to be maintain, I think it's good to use a heap.
@Pickolzi9 ай бұрын
I am still new to this topic but I will try to explain why I believe it is better to use heaps. Say you have a list of 10,000 elements and that you always need the lowest or highest number. If you are constantly adding and removing elements from the array, after each append() or pop(), you will need to sort the list to maintain the order of the list. 1. Using list.sort() will at worst case run in O(n*logn) run time 2. iterating through each item of the list to find the proper position to place the new element will at worst case run in O(n) run time 3. inserting an element in a heap will at worst case run in O(logn) run time So to insert a new element into a 10,000 element array and maintain order would take 1. ~130,000 iterations for list.sort() 2. ~10,000 iterations for iterating the array 3. ~14 iterations for a heappush() So imagine you have 10,000 people trying to buy tickets online, each person has a rank depending on previous activity. You can store their data in a tuple (rank, user_id). So when tickets start to become available for sale and the website wants to prioritize higher ranked customers, using a heap will allow the website to run a lot faster especially with a large audience.
@disrael21019 ай бұрын
cool thanks for the explanation, it makes sense only the math formula i didn't understand as you didn't explain what each parameter means.. also what's the equalivent of heap in js? as i work with js for webapps@@Pickolzi
@AryanSingh-eq2jv8 ай бұрын
free palestine
@disrael21018 ай бұрын
in ur dreams :DD@@AryanSingh-eq2jv
@soniahandle Жыл бұрын
hi, can someone explain what "maintaining heap invariant" means?
@serratedhumor8468 Жыл бұрын
invariant = unchanging, immutable.
@lzdps2 жыл бұрын
awesome!
@홍성의-i2y10 ай бұрын
valid heap: 2:12 of kzbin.info/www/bejne/npzcq5aCoNKieLs => parent should be smaller than children (min-heap).
@digvijaynadimetla99342 жыл бұрын
devudivi sami
@AryanSingh-eq2jv8 ай бұрын
i love you
@AKProductionsTelugu4 ай бұрын
Put the fucking mic closer to you
@niteshanthony23242 жыл бұрын
Hey everyone ik its pretty late but i just wanna tell u all to take it easy, relax, pray to GOD and have and trust in GOD as well as believe in his one and only son Jesus and to repent of your sins. hope u have an amazing day