# Binary heap basics

**Binary Heap** - A binary heap is a **complete binary tree** where the **heap order property** is always maintained.

**Binary Tree** - A binary tree is either
a) empty (no nodes), or
b) contains a root node with two children which are both binary trees.

**Complete Binary Tree** - A binary tree where there are no missing nodes in all except at the bottom level. At the bottom level the missing nodes must be to the right of all other nodes.

complete binary trees:

not complete binary trees:

**Heap Order Property**: The priority of the children of each node must be lower than that in the node. In this picture, we define priority to be smaller value having higher priority, thus the smallest value, has the highest priority: