Heaps

What is a Heap?

  • Notes on heaps here

Two Types of Heaps

Min Heap

Max Heap

Different Applications of Heaps:

  1. Heap Sort

  2. Priority Queues

Priority Queues

Is a collection of prioritized elements that allow arbitrary element insertion, and allows the removal of the element that has first priority. When an element is added to a priority queue, the user is designate its priority by providing an associated key. The element with the minimum key will be the next to be removed from the Queue.

Example:

An airplane may be full, and in-order to decided who on the waiting list is next available might rely on other things then those who arrived first, like airline points

Priority Queues

inserting an Image inserting an Image inserting an Image inserting an Image inserting an Image inserting an Image inserting an Image