Learn all these terms:
What is the maximum number of nodes in a binary tree of height \(h\)?
\(N(h) \leq ??\)
\(\displaystyle\sum_{i=1}^n c = cn\) |
\(\displaystyle\sum_{i=1}^n i = \displaystyle\frac{n(n+1)}{2}\) |
\(\displaystyle\sum_{i=1}^n i^2 = \displaystyle\frac{n(n+1)(2n+1)}{6}\) |
\(\displaystyle\sum_{i=0}^n r^i = \displaystyle\frac{1 - r^{n+1}}{1 - r}\) |
In a linked list, we store a reference to one node, all other nodes are reachable by following \(O(n)\) references.
In a binary tree, we store a reference to one node, all other nodes are reachable by following \(O(\log_2 n)\) references.
Trace the following traversal method…