n个节点的二叉树的最大和最小叶子节点数分别是多少?

What is the maximum and minimum number of leaf nodes of a binary tree with n nodes?

据我了解,n节点二叉树的最小叶子节点数为1,最大叶子节点数为⌈n/2⌉。我的假设是否正确?

  • 二叉树的叶节点数 >= 1 完全正确。

  • 叶节点数 <= ⌈n/2⌉:

证明:

  • 对于 n=1,叶节点数 = 1
  • 对于每 <1 left branch & 1 right branch under the same leaf> 你停止一片叶子,并创建 2 个新叶子 (每 2 个节点 +1 个叶子)
  • 对于您在叶子下创建的每个 <left branch><right branch>,您将阻止叶子成为这样并创建 1 个新叶子 (每个节点 +0 个叶子)

因此,最多叶节点数 <= 1 + ((n-1)//2) = ⌈n/2⌉