Why And When To Use Binary Heaps

Image for post
Image for post

There are 2 main reasons to use a Binary Heap, which was created by J.W. J. Williams in 1964 for heapsort.

Why Use Binary Heaps ?

  1. For instant access to the largest value in the case of a Max Heap or the smallest value in the case of a Min Heap. By “instant access” I mean constant time or O(1) for you computer scientists. This just means that we know where the value will be which is in the root of the tree or at the start of the array, depending on which data structure you are using.
  2. Useful for priority queues or schedulers, where the earliest item is desired. A practical application for this may be prioritizing patients at a hospital to work on with the highest priority

If you would like to learn more about computer science and Algorithm Analysis , you can take my online course here. I also have a course on Udemy.com called Recurrence Relation Made Easy where I help students to understand how to solve recurrence relations and asymptotic terms such as Big-O, Big Omega, and Theta. You can check out my YouTube channel of videos where I solve recurrence relations and perform algorithm analysis on code that anyone can check out for free !

Image for post
Image for post

Thanks for reading this article I hope its helpful to you all ! Keep up the learning, and if you would like more computer science, programming and algorithm analysis videos please visit and subscribe to my YouTube channels (randerson112358 & compsci112358 )

Check out the following for content / videos on Computer Science, Algorithm Analysis, Programming and Logic:

YouTube Channel:
randerson112358: https://www.youtube.com/channel/UCaV_0qp2NZd319K4_K8Z5SQ

compsci112358:
https://www.youtube.com/channel/UCbmb5IoBtHZTpYZCDBOC1CA

Website:
http://everythingcomputerscience.com/

Video Tutorials on Recurrence Relation:
https://www.udemy.com/recurrence-relation-made-easy/

Video Tutorial on Algorithm Analysis:
https://www.udemy.com/algorithm-analysis/

Twitter:
https://twitter.com/CsEverything

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store