Work out binary tree nodes instantly with clear inputs, formula shown and shareable results.
A binary tree of height h holds at most 2^(h+1) − 1 nodes when perfect and as few as h + 1 when it degenerates into a chain. Conversely n nodes need a height of at least ⌈log₂(n + 1)⌉ − 1.
Maximum nodes
N_max = 2^(h+1) − 1
Minimum height
h_min = ⌈log₂(n + 1)⌉ − 1
At most 2⁷ − 1 = 127, with 64 of them leaves.
At least ⌈log₂ 101⌉ − 1 = 6, which is why balanced trees keep operations logarithmic.