u3 Flashcards
The three laws of recursion:
- A recursive algorithm must have a base case.
- A recursive algorithm must change its state and move towards the base case.
- A recursive algorithm must call itself
binary tree
a tree in which each node has a maximum of two children and each child of a node is designated as the left or right child
Preorder
root, then left subtree,then right subtree.
Inorder:
left subtree, then root, then right subtree.
complete binary tree
a binary tree in which all parents have two children, except for the parents of children at the bottom level of the tree. At the bottom level, all nodes must be as far to the left as possible.
binary heap
a complete binary tree with an ordering rule (the heap order property) which states that parent nodes are either less than or equal to their children (a min heap) or greater than or equal to their children (a maxheap).
Heapifying
the process of creating a binary heap from a list.Heapifying is possible in O(n) time.