Binary Heap in C++

  • Also Known as a Priority Queue

Binary Heap Tree Properties

  1. It’s a complete tree, in which all levels are completely filled except possibly the last level! If the last level isn’t full, the values must be as far left as possible

  2. Is either a Min Heap or a Max Heap

How is a Binary Heap Represented?

  • A Binary Heap is typically represented as an array, with the root element being at Array[0] index.

Applications of Heaps

  1. Heap Sort
  2. Priority Queue
  3. Graph Algorithms

Operations on a Heap