updated: 2022-05-05_10:06:59-04:00
- $\mathcal{E}$
- Like an empty transition
- Lets you jump states without input
Heaps
- A complete binary tree
- values are partially ordered
- Used to implement a priority queue
Types:
- Max Heap
- every node stores value >= values of children
- root has biggest value
- Min Heap
- every node stores value <= values of children
- root has smallest value
Insertion:
- If heap has n items, insert to n+1, then sift to proper place
Sift down
- Used
Sift up
- do left subtree, then right subtree, then root
- when receiving values one at a time to build, or adding a new one
Only delete from root
- Replace with right most leaf
- sift down
- $\mathbb{\Theta}(log(n))$