Question: what is the formula to calculate the total number of nodes?
Answer: With L levels, the tree has 1 + N + N^2 + ... + N^(L-1) nodes. The total number of nodes is (N^L-1) / (N-1).