Basic knowledge:
1. The binary tree layer I has a maximum of 2 ^ (i-1) nodes.
2. A k-depth binary tree can have at most 2 ^ K-1 nodes.
A complete binary tree has seven hundred nodes and asks how many leaf nodes the binary tree has.
According to "The layer I of a binary tree has at most 2 ^ (I & minus; 1) nodes, and the depth of k has at most 2 ^ k & minus; 1 node (the root node depth is 1) "this property:
Because 2 ^ 9-1 <700 <2 ^ 10-1, the depth of the complete binary tree is 10, and the first nine layers are full binary trees,
In this case, there are 2 ^ 9-1 = 511 nodes in the first nine layers, and the number of nodes in the ninth layer is 2 ^ (9-1) = 256.
Therefore, the number of leaf knots on the tenth layer is 700-511 = 189;
Now we can calculate the number of leaf nodes on the ninth layer.
Because the leaf node on the tenth layer is extended from the ninth layer, the node on the ninth layer should be removed. Because there are 189 in layer 10, remove (189 + 1)/2 = 95 in Layer 9;
Therefore, the number of leaf nodes on the ninth layer is 256-95 = 161. In addition, there are 189 leaf nodes on the tenth layer, and the final result is 350.
A complete binary tree with 800 nodes. What are the leaf nodes?
Answer: 400
How to calculate the number of leaf nodes in a binary tree