Heaps & Priority Queues in Python

  Рет қаралды 71,721

NeuralNine

NeuralNine

Күн бұрын

Пікірлер: 36
@dhbroad2660
@dhbroad2660 Жыл бұрын
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 4 ай бұрын
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.
@AdoptingCode
@AdoptingCode 4 ай бұрын
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?
@vikasjha1064
@vikasjha1064 4 ай бұрын
Brilliant mate, ,Please make these type of explanation for other Data Structure also. Thanks
@anthonyrojas9989
@anthonyrojas9989 8 ай бұрын
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
@rafaelsartoricavalcante4253
@rafaelsartoricavalcante4253 10 ай бұрын
Best video on subject, thanks
@abhishekpardeshi5701
@abhishekpardeshi5701 6 ай бұрын
you did not mention priority queue code
@servantofthelord8147
@servantofthelord8147 4 ай бұрын
Thank you!
@adarshsasidharan254
@adarshsasidharan254 Жыл бұрын
Brilliant video
@tcgvsocg1458
@tcgvsocg1458 2 жыл бұрын
can you do a video on screen recorder but no import with vanilla pyhton please
@takshdhabalia1476
@takshdhabalia1476 2 жыл бұрын
Great video Loved the content Keep it up
@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 9 ай бұрын
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 9 ай бұрын
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 8 ай бұрын
free palestine
@disrael2101
@disrael2101 8 ай бұрын
in ur dreams :DD@@AryanSingh-eq2jv
@soniahandle
@soniahandle Жыл бұрын
hi, can someone explain what "maintaining heap invariant" means?
@serratedhumor8468
@serratedhumor8468 Жыл бұрын
invariant = unchanging, immutable.
@lzdps
@lzdps 2 жыл бұрын
awesome!
@홍성의-i2y
@홍성의-i2y 10 ай бұрын
valid heap: 2:12 of kzbin.info/www/bejne/npzcq5aCoNKieLs => parent should be smaller than children (min-heap).
@digvijaynadimetla9934
@digvijaynadimetla9934 2 жыл бұрын
devudivi sami
@AryanSingh-eq2jv
@AryanSingh-eq2jv 8 ай бұрын
i love you
@AKProductionsTelugu
@AKProductionsTelugu 4 ай бұрын
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
@xEpsi
@xEpsi Жыл бұрын
stop advertising jesus in a python tutorial
2.6.3 Heap - Heap Sort - Heapify - Priority Queues
51:08
Abdul Bari
Рет қаралды 2,2 МЛН
When u fight over the armrest
00:41
Adam W
Рет қаралды 31 МЛН
Amazing remote control#devil  #lilith #funny #shorts
00:30
Devil Lilith
Рет қаралды 16 МЛН
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3 МЛН
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 111 МЛН
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 329 М.
Makefiles in Python For Professional Automation
13:43
NeuralNine
Рет қаралды 45 М.
LeetCode was HARD until I Learned these 15 Patterns
13:00
Ashish Pratap Singh
Рет қаралды 577 М.
Heaps, heapsort, and priority queues - Inside code
19:01
Inside code
Рет қаралды 96 М.
Heap Explained - Algorithms & Data Structures #20
12:59
NeuralNine
Рет қаралды 11 М.
Heaps Explained (Priority Queues)
12:03
ByteQuest
Рет қаралды 212
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 688 М.
Lecture 4: Heaps and Heap Sort
52:32
MIT OpenCourseWare
Рет қаралды 867 М.
When u fight over the armrest
00:41
Adam W
Рет қаралды 31 МЛН