Heaps, heapsort, and priority queues - Inside code

Поделиться
HTML-код
  • Опубликовано: 23 дек 2024

Комментарии • 130

  • @insidecode
    @insidecode  Год назад +7

    Discover the new graph theory algorithms course: inscod.com/graphalgo
    🔴
    / \
    🔵-🔴
    | |
    🔴-🔵

  • @varunalur3988
    @varunalur3988 2 года назад +78

    This is hands down the best explanation of heaps. You're a very talented person, thanks so much for your efforts.
    You did in 19 minutes what my professor is incapable of doing in 3 hours.

  • @MoscleBrog
    @MoscleBrog 10 месяцев назад +9

    Animated example in algorithm. YES PLEASE.
    This is the best explaination with showing the flow of the program. TY Inside Code

  • @josiahdavid7735
    @josiahdavid7735 2 года назад +30

    Watching the heapsort at 15:25 was so fun! This is a great video. With excellent explanations and visuals, Great Job!

  • @Sapphiamur
    @Sapphiamur 9 месяцев назад +1

    Best explanation, seriously, all the graphics were so helpful! Thank you so much!

  • @BlaBlaBlaInDaHouse
    @BlaBlaBlaInDaHouse Год назад +6

    This is definitively the best video on heaps! Thank you for your effort

  • @ryan_altalhi7901
    @ryan_altalhi7901 Год назад

    00:10 Heap data structure helps in quickly accessing the most important task
    02:26 Storing a complete binary tree in an array is more efficient
    04:30 Sift-up and sift-down operations maintain the heap property in a binary heap.
    06:48 Operations in a heap
    09:03 Updating and building heap in heapsort
    11:16 Understanding the time complexity of heapifying.
    13:34 Heapsort is a sorting algorithm using the heap data structure with a time complexity of O(nlogn)
    17:05 Heapsort has O(nlogn) time complexity.

  • @spatialfeelings
    @spatialfeelings 26 дней назад +1

    Very straightforward video with clear graphics. Appreciate your work!

  • @lazarus6983
    @lazarus6983 16 дней назад +1

    wow. that proof for heapify runtime is so beautiful. take my sub for that

  • @Som-yc4ql
    @Som-yc4ql 10 дней назад

    This is by far the best explanation I've seen on this topic! Thank you so much!

  • @stasdurka
    @stasdurka 11 месяцев назад +2

    Great video. I appreciate the work you put in these videos and the fact that you explain the concept very well (it takes real understanding to be able to teach something like this, unlike many channels out there wasting the viewer's time going through some example step by step on a whiteboard). Had to review some old stuff from uni and I'm so glad I found your channel :)

  • @vadvoker
    @vadvoker 2 года назад +3

    I'm completing the course called "Algirithms and data structures". There is only text explanation of such things and I thought "it's too complicated", but after your video everything became clear. Thanks a lot!

    • @insidecode
      @insidecode  2 года назад +6

      You're welcome! Yes a lot of resources lack visualization, which is necessary for some people to understand, this is why I'm planning to make a full algorithms and data structures course in this style

  • @MateoAcosta-zi2us
    @MateoAcosta-zi2us Год назад +2

    Incredible way of teaching. Little step by step, beautiful and organized illustrations. Thank you very much :D!

  • @akshaygoel2184
    @akshaygoel2184 2 года назад +7

    The animations are incredible! I'm amazed at the detail

  • @sweetphilly2
    @sweetphilly2 Год назад +1

    Really do appreciate you letting a thought/point/concept breathe before moving on. It gives the listener some time to process without noise (i.e. the presenter talking) before moving along with the lesson 👍

  • @martingeorgiev999
    @martingeorgiev999 Год назад

    13:35 for people like me who get confused: the sum it's equal to 1/(1-x) for every x < 1 (in our case we have x = 1/2)

  • @joj0ee
    @joj0ee Год назад

    The use of a power series at 13:20 to find the time complexity blew my mind. I never thought about how time complexities are actually proved.

  • @elyababakova2125
    @elyababakova2125 Год назад +2

    Very nice summary and illustrations of heap!

  • @HyperFocusMarshmallow
    @HyperFocusMarshmallow Год назад

    13:28 I like that you present the math here. Props for that.
    The following is not a critique of any relevance but I can’t help pointing out that I found the following steps a bit funny:
    1/2^{k-1} = 1^{k-1}/2^{k-1}
    = (1/2)^{k-1}.
    It’s maybe a bit convoluted and didn’t need so many steps.
    But no worries really.

  • @azizbenanaya8833
    @azizbenanaya8833 Год назад +1

    very elegant way of explaining heaps straight to the point simple but efficient keep the great content up 🙌

  • @fredericoamigo
    @fredericoamigo 5 месяцев назад

    This video is one of the best I've seen on the topic. Simply brilliant! Keep up the good work!

  • @홍성의-i2y
    @홍성의-i2y Год назад

    14:22 time complexity of each operation.
    build=heapify=make an array as a binary heap.

  • @dominiquekostler238
    @dominiquekostler238 Год назад +2

    I believe there's a minor mistake in the explination here 2:50. Shouldn't we be talking the floor of (i-1)/2 ? Since if we are for example at index 7 then only doing (7-2)/2 = 2.5. And there can't be a 2.5 index position in an array.

    • @insidecode
      @insidecode  Год назад +1

      Yes, this is why in code at 4:24 I wrote parent = (i-1)//2, a//b in Python is equivalent to floor(a/b)

    • @dominiquekostler238
      @dominiquekostler238 Год назад

      @@insidecode I saw that later on, just wanted to point out to you if you want to edit the video position with a note saying it should be the floor instead of just how it is.

    • @chiragsharma8905
      @chiragsharma8905 Год назад

      That won't be the case in languages like Java, as for integer-integer operations, decimal is ignored. So, it will give us 2 only.

  • @tb0707-m8w
    @tb0707-m8w Год назад +4

    Awesome explanation!
    Keep up the good work, continue improving and one day your channel will be huge!

  • @rongitmukherjee
    @rongitmukherjee 3 месяца назад

    Wish I had watched this video in college when it was in my syllabus. Better late than never, great explanation, better than others.

  • @tanishq2766
    @tanishq2766 2 года назад

    Never Ever Stop Making Videos, That's All I Got To Say, Period !

  • @HyperFocusMarshmallow
    @HyperFocusMarshmallow Год назад

    10:21 It makes sense that for constructing the heap, sift up (I hope I’m correctly recalling which one is which) is better than sift down and that starting from the bottom is beneficial.
    Is this the best one can do? If so do you know of a good resource for the proof?
    I might try to figure it out in my own, but it’s at least nice to know whether I’m trying to prove or disprove it.

  • @gayatrimamidwar8364
    @gayatrimamidwar8364 3 месяца назад

    step by step animation + explanation that's what make the DSA to understand very clearly. Thanks a lot.... subscribed😊 please make more videos..

  • @shyngysbek6907
    @shyngysbek6907 7 месяцев назад

    By far the best video about Heap-sort algorithm. Thank you!

  • @sainathsingineedi2922
    @sainathsingineedi2922 3 года назад +16

    Commenting for algorithm. Nice work 🔥

  • @ElevateCode
    @ElevateCode 4 месяца назад

    The animations are super helpful, great job and thank you for such a good explanation!

  • @paul_tee
    @paul_tee Год назад

    This is a minor point, but when you do the analysis of the build function and you take the derivative of the geometric series, you should keep in your notation that you’re evaluating at x=1/2. You’re abusing the letter x, but I get that space was already tight.

  • @stazchristo
    @stazchristo 2 месяца назад

    Great Heap Video and Great Visualizations, Thanks!

  • @safayetkhan2803
    @safayetkhan2803 Год назад +1

    Used to love ur videos but now I love these even more becaz of ur last word Inshallah

  • @someoneunknown2720
    @someoneunknown2720 3 года назад +10

    Never knew about the heaps . Again thanks for increasing my knowledge 😍😍🥰✌️

  • @ismailabi226
    @ismailabi226 Год назад

    Kayn akhay. char7 nadi, sauvitini, hit had partie mabghatch dkhol liya lrassi bmara

  • @tabhashim3887
    @tabhashim3887 4 месяца назад

    Best video on this topic. period.

  • @vikimazo
    @vikimazo 3 года назад +2

    The best explanation of heaps! Thanks!

  • @chrisogonas
    @chrisogonas 10 месяцев назад

    Remarkable illustration! Thanks Pal

  • @skyblock127
    @skyblock127 3 месяца назад

    @ 3:00 i think parent will be at (i-2)/2 not (i-1)/2

  • @SorestCode
    @SorestCode 5 месяцев назад

    i want to ask how did you do the graphic effects and all stuff in the video which tools did you use? thanks!

  • @blaine_stl
    @blaine_stl 2 года назад

    of all videos I've scoured on binary heap this is the best

  • @elmeroranchero
    @elmeroranchero 11 месяцев назад

    why is finding the element O(n) isn't it like a binary search essentially?

  • @edilgin
    @edilgin 10 месяцев назад

    Isn't heapsort supposed to have O(1) space complexity? In your code you create a seperate array that holds the sorted data which would make it O(n). In the implementations that I saw they use the same heap array for sorting as well. Any help is welcome :)

  • @ohmegatech666
    @ohmegatech666 Год назад

    Somehow I didn't know about the // operator in Python until now. For anyone confused, it does the same thing as math.floor (a/b)

  • @ddevarapaga5134
    @ddevarapaga5134 3 месяца назад

    best video ever for heap thank you

  • @gagansaluja5523
    @gagansaluja5523 2 года назад

    you deserve millions of subscribers

  • @pancakebananasplash
    @pancakebananasplash Год назад

    Great tutorial! My only note is (pretty please) use a pop filter when you record your voice over. The plosives are kind of distracting :D. Thank you for putting this together though!

  • @felipefarah9720
    @felipefarah9720 2 года назад

    Great stuff! Best explanation ive seen so far

  • @chandrashekharmuradnar5681
    @chandrashekharmuradnar5681 7 месяцев назад

    Very good stuff, thanks for the compiling this video.

  • @deveeshmusic5045
    @deveeshmusic5045 4 месяца назад

    beautiful explanation!

  • @richardlighthouse5328
    @richardlighthouse5328 2 года назад

    Couldn't you use binary search on the heap to get the index so updating element always cost O(log n), since the heap is always sorted?

    • @insidecode
      @insidecode  Год назад +1

      No the heap is not always sorted

  • @esportsnexus
    @esportsnexus 3 года назад +3

    Best explanation ever! I'm gonna buy your udemy courses!

  • @vadvoker
    @vadvoker 2 года назад +1

    Man, that's cool, clear and understandable! Thank you!

  • @lucas-bw6zu
    @lucas-bw6zu Год назад

    think you skipped get max. I guess you could store a max heap with the min heap but that is 0n space complexity, or you could sort thru the array but that is 0n time complexity. Any other ways?

    • @insidecode
      @insidecode  Год назад +1

      Usually to use a max heap we just use a min heap but by switching signs of keys when inserting

    • @lucas-bw6zu
      @lucas-bw6zu Год назад

      ​@@insidecode thank you that makes sense. I was under assumption we could call get min and get max in the same heap, but I realize you wouldnt call "get max" on a min heap.

  • @tommyp713
    @tommyp713 7 месяцев назад

    Thank you so much, this is a brilliant explanation

  • @jacquelineandrea616
    @jacquelineandrea616 2 года назад

    wow, best video of heaps ever

  • @jironymojirolamus913
    @jironymojirolamus913 4 месяца назад

    Thanks, great explanation!

  • @anowlwithinternet9125
    @anowlwithinternet9125 4 месяца назад

    Thank you so much! your video is real GOLD

  • @aabibodd
    @aabibodd 2 года назад

    put in the priority queue if two elements have the same priority the first one enters should be the first.

    • @insidecode
      @insidecode  2 года назад

      What do you mean by first one? First one in terms of what?

  • @ohmegatech666
    @ohmegatech666 Год назад

    This video is a treasure!

  • @AbdelazizElHayyany
    @AbdelazizElHayyany 10 месяцев назад

    great explanation

  • @apoorv0505
    @apoorv0505 2 года назад

    Great explanation. 🥂

  • @____r72
    @____r72 2 года назад

    this is such a good explanation

  • @كمشكي
    @كمشكي 9 месяцев назад

    18:43 that got me

  • @sequbeats
    @sequbeats 2 года назад

    Great visualization!

  • @charles7684
    @charles7684 2 месяца назад

    best explanation

  • @paul_tee
    @paul_tee Год назад

    Fantastic content

  • @rerjo999
    @rerjo999 22 дня назад

    inshallah is something else ❤

  • @manim4434
    @manim4434 Месяц назад

    Thank you, it was the best

  • @murnoth
    @murnoth 2 года назад

    Great content! Thanks for sharing!

  • @sayeedchowdhury11
    @sayeedchowdhury11 2 года назад

    great video, brother! MashA Allah

  • @idocoding2003
    @idocoding2003 Месяц назад +1

    ❤❤❤❤❤❤ wowww

  • @youngKOkid1
    @youngKOkid1 Месяц назад

    Great video.

  • @adoq
    @adoq 5 месяцев назад

    this video is amazing

  • @spiritgaming6499
    @spiritgaming6499 6 месяцев назад

    Amazing video

  • @bombay7368
    @bombay7368 16 дней назад

    i fw this heavy, good shit fn

  • @ParthPatel-sr8mz
    @ParthPatel-sr8mz 3 года назад

    Can we connect on LinkedIn? May I ask your name?

    • @insidecode
      @insidecode  3 года назад

      I'm not active on LinkedIn sorry

  • @muzaffartursunov324
    @muzaffartursunov324 11 месяцев назад

    super hard working

  • @davidondemand3631
    @davidondemand3631 2 года назад

    bless your kind heart

  • @ikram5011
    @ikram5011 2 года назад

    thank u so much amazing explanation

  • @nastalgja
    @nastalgja Год назад

    Sooo good, thanks

  • @KateONeillLumpySpaceKate
    @KateONeillLumpySpaceKate 2 года назад +11

    inshallah i will pass my exams

  • @mehdididit
    @mehdididit 3 года назад

    BIEN OUEJ SYP

  • @lexkoal8657
    @lexkoal8657 6 месяцев назад

    Sorry, but using x as a constant just doesn't feel okay 13:20

  • @XajiDahir
    @XajiDahir 2 года назад

    mash allah. bareekallahu feek

  • @sharjeel_mazhar
    @sharjeel_mazhar 5 месяцев назад

    That's IN SHA ALLAH really made me happy, to see a Muslim man making these great videos with easy and visual explanations! 🔥 Kudos to you 💯 keep doing the hard work, you will reach 1M some day IN SHA ALLAH!

  • @reng7777
    @reng7777 2 года назад +1

    Genius!!!

  • @mattp6460
    @mattp6460 4 месяца назад

    thankyou

  • @ismail8973
    @ismail8973 3 года назад

    Love from india👌

    • @insidecode
      @insidecode  3 года назад

      Thanks!

    • @ismail8973
      @ismail8973 3 года назад

      @@insidecode bro i got placed in last week. Your vedeos helped a lot.

    • @sweetjimmy
      @sweetjimmy 3 года назад

      @@ismail8973 Where did you get placed?

    • @ismail8973
      @ismail8973 3 года назад

      @@sweetjimmy American Express

  • @iezioaudi22
    @iezioaudi22 10 месяцев назад

    Thanks!!!!

  • @eduardocruzism
    @eduardocruzism Год назад

    Amazing

  • @ugurkaraaslan9285
    @ugurkaraaslan9285 2 года назад

    İnşaallah 👍

  • @allinonesomespecial4
    @allinonesomespecial4 9 месяцев назад

    🤞👍👌

  • @chi94
    @chi94 9 месяцев назад +1

    who else skipped the math part 😆

  • @baba5788
    @baba5788 3 года назад

    Legend

  • @midasredblade236
    @midasredblade236 2 года назад +1

    you're muslim, didnt see that coming brother

  • @flexicus1105
    @flexicus1105 4 месяца назад

    Now when will I use this in an actual job? Likely never

  • @tsunningwah3471
    @tsunningwah3471 8 месяцев назад

    官方幸福高雄法國香港發現法國幸福高雄

  • @tsunningwah3471
    @tsunningwah3471 8 месяцев назад

    zhi