Determine a formula that expresses the height of the tree:
Answer: General Recursion Tree:
1 = 2^0
2 = 2^1
T(n/2)
T(n/2)
4 = 2^2
T(n/4)
T(n/4)
T(n/4)
T(n/4)
log2
T(n/8)
T(n/8)
T(n/8)
T(n/8)
T(n/8)
T(n/8)
T(n/8)
T(n/8)
8 = 2^3
T(1)
T(1)
T(1)
T(1)
T(1)
T(1)
n = 2k
Therefore, the height of the binary tree is log2(n) and because we have a binary tree, the formula to find the number of nodes would be 2n-1 or 2log(n)+1.