Week 9: heaps, priority queues ---------------------------------------------------------------------------- We finished to review trees with the introduction of heaps, that are a specific kind of binary tree. Actually, when we speak about heaps, they are either min or max heaps. A min heap is a tree satisfying the following properties: - it is a binary tree; - it is a complete tree; - the root is <= than both its children; - the left sub-tree and the right sub-tree are also min heaps. We discussed how to build a heap, and also how to remove the root of the heap and to re-heap it. Then we discussed how a heap can be seen as a priority queue. Since we had already discussed about priority queues earlier when presenting queues, the concept was not new.