Calculator
Use one of the advanced modes below to calculate perfect tree metrics, full tree relations, general bounds, or traversals from an array view.
Formula used
How to use this calculator
Example data table
| Mode | Input | Selected Result | Output Example |
|---|---|---|---|
| Perfect Tree from Levels | Levels = 4 | Total Nodes | 15 |
| Perfect Tree from Total Nodes | Total Nodes = 31 | Levels | 5 |
| Full Tree Relation | Leaf Nodes = 9 | Total Nodes | 17 |
| General Tree Bounds | Levels = 5, Actual Nodes = 19 | Occupancy Ratio | 61.29% |
| Traversal from Array | 10, 7, 15, 5, 8, null, 20 | Preorder | 10, 7, 5, 8, 15, 20 |
FAQs
1) What does levels mean in this calculator?
Levels count horizontal rows from the root downward. A tree with only a root has one level and a height of zero edges.
2) What is the difference between a full tree and a perfect tree?
A full tree gives every internal node exactly two children. A perfect tree is full and also has every leaf at the same depth.
3) Why are some total node counts not valid for perfect trees?
Perfect trees must follow 2L - 1. That creates counts like 1, 3, 7, 15, and 31. Other totals are not exact perfect sizes.
4) How does traversal mode interpret my list?
It reads the list as a level-order array. Missing children can be written as null, and child positions follow the index formulas shown above.
5) What makes a tree complete?
A complete tree fills every level from left to right, except possibly the last. There cannot be a gap before a later node appears.
6) Can I use text labels instead of numbers in traversal mode?
Yes. You may enter symbols, names, or numbers. Traversal mode treats each non-null entry as a node label.
7) What does occupancy ratio mean?
Occupancy ratio compares actual nodes with the maximum nodes possible for the selected levels. It shows how full the structure is as a percentage.
8) Why are CSV and PDF exports useful here?
They let you keep a copy of calculated metrics for homework, planning, reviews, or quick sharing without retyping the results.