Heaps & Priority Queues in Python

  Рет қаралды 75,997

NeuralNine

NeuralNine

Күн бұрын

Пікірлер: 38
@alexneigh7089
@alexneigh7089 18 күн бұрын
I am a distance learner, and for me such vids are extremely valuable. It feels like real university lectures when I was younger, with quite a few advantages in comparison.
@NeuralNine
@NeuralNine 18 күн бұрын
Glad to hear it helps! :)
@dhbroad2660
@dhbroad2660 2 жыл бұрын
Thank you for this! So many other videos on heaps just speak about the theory, but don't show any implementation or manipulation.
@Gooloso98
@Gooloso98 2 жыл бұрын
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).
@soufianeaitlhadj9115
@soufianeaitlhadj9115 5 ай бұрын
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.
@MaybeGriffin
@MaybeGriffin 5 ай бұрын
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?
@rafaelsartoricavalcante4253
@rafaelsartoricavalcante4253 Жыл бұрын
Best video on subject, thanks
@vikasjha1064
@vikasjha1064 6 ай бұрын
Brilliant mate, ,Please make these type of explanation for other Data Structure also. Thanks
@takshdhabalia1476
@takshdhabalia1476 2 жыл бұрын
Great video Loved the content Keep it up
@adarshsasidharan254
@adarshsasidharan254 2 жыл бұрын
Brilliant video
@홍성의-i2y
@홍성의-i2y Жыл бұрын
valid heap: 2:12 of kzbin.info/www/bejne/npzcq5aCoNKieLs => parent should be smaller than children (min-heap).
@anthonyrojas9989
@anthonyrojas9989 10 ай бұрын
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
@disrael2101
@disrael2101 2 жыл бұрын
What for / where it's used for mainly
@jerrylin4980
@jerrylin4980 2 жыл бұрын
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.
@Pickolzi
@Pickolzi 11 ай бұрын
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.
@disrael2101
@disrael2101 10 ай бұрын
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-eq2jv
@AryanSingh-eq2jv 10 ай бұрын
free palestine
@disrael2101
@disrael2101 10 ай бұрын
in ur dreams :DD@@AryanSingh-eq2jv
@servantofthelord8147
@servantofthelord8147 6 ай бұрын
Thank you!
@tcgvsocg1458
@tcgvsocg1458 2 жыл бұрын
can you do a video on screen recorder but no import with vanilla pyhton please
@soniahandle
@soniahandle Жыл бұрын
hi, can someone explain what "maintaining heap invariant" means?
@serratedhumor8468
@serratedhumor8468 Жыл бұрын
invariant = unchanging, immutable.
@lzdps
@lzdps 2 жыл бұрын
awesome!
@abhishekpardeshi5701
@abhishekpardeshi5701 7 ай бұрын
you did not mention priority queue code
@digvijaynadimetla9934
@digvijaynadimetla9934 2 жыл бұрын
devudivi sami
@AKProductionsTelugu
@AKProductionsTelugu 5 ай бұрын
Put the fucking mic closer to you
@niteshanthony2324
@niteshanthony2324 2 жыл бұрын
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
@dheerajsharma355
@dheerajsharma355 Жыл бұрын
Hare Krishna!!
@Mr_Clumsee
@Mr_Clumsee Жыл бұрын
Jai Shree Ram!!
@mrsteth993
@mrsteth993 Жыл бұрын
Jesus isn't real.
@caio-jl6qw
@caio-jl6qw Жыл бұрын
Bot
@epsi.mp3
@epsi.mp3 Жыл бұрын
stop advertising jesus in a python tutorial
@AryanSingh-eq2jv
@AryanSingh-eq2jv 10 ай бұрын
i love you
2.6.3 Heap - Heap Sort - Heapify - Priority Queues
51:08
Abdul Bari
Рет қаралды 2,3 МЛН
Маусымашар-2023 / Гала-концерт / АТУ қоштасу
1:27:35
Jaidarman OFFICIAL / JCI
Рет қаралды 390 М.
Хаги Ваги говорит разными голосами
0:22
Фани Хани
Рет қаралды 2,2 МЛН
5 Python Libraries You Should Know in 2025!
22:30
Keith Galli
Рет қаралды 84 М.
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 778 М.
Stacks and Queues (Python) - Data Structures and Algorithms
14:10
Heapq Module And Priority Queue | Binary Heap | Python Tutorials
11:56
Amulya's Academy
Рет қаралды 32 М.
I Solved 1583 Leetcode Questions  Here's What I Learned
20:37
ThePrimeTime
Рет қаралды 784 М.
Heaps, heapsort, and priority queues - Inside code
19:01
Inside code
Рет қаралды 106 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 727 М.
Reinforcement Learning - My Algorithm vs State of the Art
19:32
Pezzza's Work
Рет қаралды 148 М.