What makes the Binary Heap so amazing?
A free video tutorial from Jonathan Rasmusson
Ex-Spotify Engineer, The Agile Samurai
4.4 instructor rating • 5 courses • 39,899 students
Learn more from the full courseData Structures and Algorithms Bootcamp
How to ace your Silicon Valley style coding interview
06:27:06 of on-demand video • Updated September 2020
- How to answer commonly asked Silicon Valley style interview questions
- Demonstrate knowledge and mastery of data structures and algorithms
- How to pass Silicon Valley style technical interviews
- Interview confidently
- Land your dream job
English Now before we get into building one of these from scratch I just wanted to go over what makes this binary heap structure so amazing. First of all, we know it's extremely fast extracting from the max, That's O(1), extremely fast operation. Super super cool. But watch this video on Wikipedia that shows how the binary heap sorts itself given a set of random data. What you're seeing here is a random data structure that's created and then they heapify or sorting algorithm applied to it getting it into its priority heap order so it's ready to x. So it's ready to extract that Max. It's an amazing algorithm because it really shows off how this can all be done in space. It's simply taking the array swapping nodes of one with one another without requiring any kind of temporary or other holding data structures or anything like that. It's all done in the space of the array itself. This is beautiful and this is hard to appreciate only people who are really into computer science and kind of look at the stuff like and appreciate what's going on here. But it's a stunning stunning display of how you can compact something into very very small space and basically have this algorithm do so much with so little space. So the next time you're talking to that special someone at that cocktail party in San Francisco and they ask you what makes the binary heap so special. You can look them in the eye and say, "Well for one is extremely fast, two, It's beautifully compact and three. It's just amazing how much you can do with so little code." And then pull out your laptop and show them how you built one from scratch just like this.