A binary tree is a tree in which each node has up to two children.
A binary search tree is a binary tree in which every node fits a specific ordering property.
all left descendents <= n < all right descendents
This must be true for each node n.
To ensure O(log n)
times for insert and find. Two common types of balanced trees are Red-Black Tree and AVL tree
A complete binary tree is a binary tree in which every level of the tree is fully filled, except the last level.
Heap is a Complete Binary Tree
A full binary tree is a binary tree in which every node has either zero or two children. That is, no nodes have only one child.
A perfect binary tree is one that is both full and complete. All leaf nodes will be at the same level, and this level has the maximum number of nodes. a perfect tree must have exactly 2^k - 1
nodes.
- In-Order Traversal
- Pre-Order Traversal
- Post-Order Traversal
A trie is a variant of an n-ary tree in which characters are stored at each node. Each path down the tree may represent a word.
- A tree is a connected graph without cycles.
- A graph can be directed or undirected.
- A graph might consist of multiple subgraphs. If there is a path between every pair of vertices, it is called a "connected graph".
- A graph can also have cycles (or not). An "Acyclic graph" is one without cycles.
- BFS
- DFS