Select Page

To get minimum height you have a complete binary tree. Note that the path must end on a leaf node. If binary tree has height h, maximum number of nodes will be when all levels are completely full. This is a binary tree such that, for any subtree, it's children have the same height. (This basically means that if you draw the tree out you don't see any "holes.") For example, the minimum height of below Binary Tree is also 2. For example, minimum height of below Binary Tree is 2. When input is inserted in random order the average height is about 1.39 * log_2 n. At depth n, the height of the tree, all nodes must be as far left as possible." A complete binary tree is "a binary tree in which evert level, except possibly the deepest, is completely filled. PS: The book that states height of a complete binary tree as \$\log_2(n+1)-1\$ is not valid for all \$n\$ because \$\log_2(n)\$ would give non-integral values for most integers \$n\$ (i.e. Given a binary tree, find its minimum depth. Binary trees have a maximum height of n when input is inserted in order, the minimum height is of course log_2(n) when the tree is perfectly balanced. So assume you have this type of tree, we want to prove its height is If binary tree has height h, minimum number of nodes is h+1 (in case of left skewed and right skewed binary tree). The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.

For example, the binary tree shown in Figure 2(a) with height 2 has 3 nodes. for all but perfect binary trees), but height of a tree is purely integral.