# 数据结构与算法分析-C语言描述--第四章题目答案

1-3 不作详细证明

4.4 证明在N个节点的二叉树中，存在N+1个NULL指针代表N+1个儿子。

所以共有： 2N-（N-1） = N+1 个NULL指针

4.5 证明在高度为H的二叉树中，节点最大个数是$2^{H+1}-1$

4.6 满节点(full Node)是具有两个儿子的节点。证明满节点的个数加1等于非空二叉树的树叶个数

4.7 设二叉树有树叶L1，L2，... ，LM，各树叶的深度分别是d1，d2，...，dM。 证明，$\sum_{1}^{M}2^{-d_{i}}\leq 1$ 并确定何时等号成立。

This can be shown by induction. In a tree with no nodes, the sum is zero, and in a one-node tree, the root is a leaf at depth zero, so the claim is true. Suppose the theorem is true for all trees with at most kO nodes. Consider any tree with kO+1 nodes. Such a tree consists of an iO node left subtree and a kO − iO node right subtree. By the inductive hypothesis, the sum for the left subtree leaves is at most one with respect to the left tree root. Because all leaves are one deeper with respect to the original tree than with respect to the subtree, the sum is at most ⁄ 1 2 with respect to the root. Similar logic implies that the sum for leaves in the right subtree is at most ⁄ 1 2, proving the theorem. The equality is true if and only if there are no nodes with one child. If there is a node with one child, the equality cannot be true because adding the second child would increase the sum to higher than 1. If no nodes have one child, then we can find and remove two sibling leaves, creating a new tree. It is easy to see that this new tree has the same sum as the old. Applying this step repeatedly, we arrive at a single node, whose sum is 1. Thus the original tree had sum 1.(先放书中答案)

to be continue...

12-02 4257

06-03 279

09-23 3442

08-14 4319

05-23 1402

10-31 1974

07-15 30

07-18 2564

04-16 1508

11-05 416

#### SDUT 叶子问题

©️2020 CSDN 皮肤主题: 技术黑板 设计师: CSDN官方博客

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、C币套餐、付费专栏及课程。