Nodes in a Full Binary Tree
Total nodes in a perfect binary tree of height h.
Live Calculator
MembersVariables
Example
A full binary tree of height 3 has 2⁴ − 1 = 15 nodes.
How it works
In a perfect binary tree, every level is completely filled and each node has exactly two children until the last level. The number of nodes doubles at each step: 1 at the root, 2 on the next level, 4 after that, and so on up to level h. Adding these levels gives 1 + 2 + 4 + ... + 2^h, which is a geometric series that sums to 2^(h+1) - 1.
When to use it
Use this formula when you know a binary tree is perfect and you need the total number of nodes from its height. It is common in data structures, tree algorithms, and analyzing the size or memory cost of complete tree-based representations.
Worked example, step by step
A perfect binary tree has height h = 4.
Substitute into the formula: N = 2^(h+1) - 1
N = 2^(4+1) - 1
N = 2^5 - 1
N = 32 - 1
N = 31
So the tree has 31 nodes.
Common mistakes to avoid
- Using this formula for any binary tree, even when the tree is not perfect
- Confusing height with the number of levels and plugging in the wrong value of h
- Forgetting the minus 1 at the end and writing only 2^(h+1)
Did You Know?
A full binary tree of height h holds 2^(h+1)−1 nodes — growth that explains why balanced trees stay shallow.
Share this formula
More in Computer Science
View allGustafson’s Law
IntermediateIdeal scaled-workload speedup when more processors allow a larger parallel task in the same elapsed time. Here s is the serial fraction of the parallel execution time, not the single-processor fraction used in Amdahl’s law.
Hick–Hyman Law (Equal Choices)
IntermediateModels choice reaction time for n equally likely alternatives (n ≥ 1). This information-theoretic form assumes comparable, practised stimulus–response choices; it is not a universal law of menu browsing.
Fitts’s Law (Shannon Form)
IntermediateAn empirical model of aimed movement time: farther or narrower targets generally take longer to reach. Use D ≥ 0, W > 0 and fitted coefficients for the device and task.
Shannon Entropy
AdvancedAverage information content of a random source (bits).
Master Theorem (form)
AdvancedAnalyzes running time of divide-and-conquer algorithms.
Hamming Distance
AdvancedNumber of positions at which two strings differ.