東京大学 情報理工学系研究科 コンピュータ科学専攻 2021年2月実施 問題1
Author
Description
Ordered binary trees are trees in which each node has at most two ordered children. Below,
For a sequence
For an ordered binary tree
where
Answer the following questions.
(1) Give the tree
(2) Show that
(3) Assume that
(4) Show that any ordered binary tree
有序二叉树是指每个节点最多有两个有序子节点的树。下面,
对于一个由
对于一个有序二叉树
其中
回答以下问题。
(1) 给出在
(2) 证明对于任何有叶节点
(3) 假设
(4) 证明对于任何有序二叉树
Kai
(1)
To minimize
Steps to construct the tree:
- Start by pairing the two smallest weights, which are both
. - Combine these to form a subtree with a combined weight of
. - Now, we have weights
. - Next, combine the two smallest remaining weights, which are both
. - Combine these to form a subtree with a combined weight of
. - Finally, combine the two subtrees
to form the complete tree.
The resulting tree structure is:
O
/ \
4 O
/ \
2 O
/ \
1 1
Thus, the depth of each leaf in the tree is:
, depth , depth , depth , depth
Now, we calculate
Thus, the tree
(2)
To prove the inequality
- Base Case
- Inductive Step
Base Case: For
Thus, the base case holds.
Inductive Step: Assume that for any ordered binary tree with
Now, we need to prove that the inequality holds for an ordered binary tree with
- Consider an ordered binary tree with
leaves. - Let's denote the depth of the leaves in this tree by
.
When we add an additional leaf to a tree with
Suppose we split the leaf
Thus, we need to show:
By the inductive hypothesis, for the original tree with
In the new tree:
Since
Thus, the inequality holds after adding a new leaf and increasing the depth of the original leaf.
By induction, the inequality
(3)
To maximize
Define the Lagrangian:
Take the partial derivatives and set them to zero:
Using the constraint
Thus, the maximizing
(4)
To show that
Recall:
We start by rewriting
Since
Next, consider the following inequality derived from Jensen's inequality for the concave function
This simplifies to:
Since
So:
The weighted path length
We multiply both sides by
Using the fact that
Now, we apply the definition of entropy:
Using Gibbs' inequality, we know that:
Multiplying both sides by
Substituting
Thus, we have shown that
Knowledge
有序二叉树 哈夫曼树 信息论 拉格朗日乘数法 数学归纳法
重点词汇
- Ordered binary tree 有序二叉树
- Huffman tree 哈夫曼树
- Depth 深度
- Lagrange multipliers 拉格朗日乘子
- Entropy 熵
- Lagrange multiplier 拉格朗日乘数
- Jensen's inequality 詹森不等式
- Gibbs' inequality 吉布斯不等式
- Kraft's inequality 克拉夫特不等式
参考资料
- Introduction to Algorithms, Chapter 16: Greedy Algorithms
- Information Theory, Inference, and Learning Algorithms, David J.C. MacKay