Question 36
Which traversal is used by an iterative level-order algorithm with a queue?
A FIFO queue processes nodes level by level.
Which traversal is used by an iterative level-order algorithm with a queue?
A FIFO queue processes nodes level by level.
What is the maximum number of nodes at depth d in a binary tree?
Each level can contain at most twice as many nodes as the previous level.
For a binary tree with n nodes, what is the maximum possible number of leaf nodes?
A full binary tree maximizes the number of leaves; with $n=2I+1$ for odd n, and for even n the maximum is n/2, giving floor((n+1)/2) in both cases.
A full binary tree has I internal nodes. How many total nodes does it have?
Every internal node has two children, giving leaves I+1 and total 2I+1.
A full binary tree has N total nodes. How many leaves does it have?
For a full binary tree, $N=2I+1$ and leaves I+1=(N+1)/2.