東京大学 新領域創成科学研究科 メディカル情報生命専攻 2016年8月実施 問題7
Author
Description
(1) Given an integer
-
(A) Let
. Find the time complexity (with regard to ) of an algorithm that calculates individually and then calculates . -
(B) Let
. Notice that holds. Find the time complexity (with regard to ) of an algorithm that calculates , hence by calculating in this order.
(2) Given two
-
(A) The multiplication of
-bit integers can be constructed from the multiplication of -bit integers as follows: , where . We can recursively apply this reduction until every multiplication only involves integers small enough to fit in the machine word of the computer. Let be the number of machine-word multiplications required in the multiplication of two -bit integers. Express in terms of . -
(B) Solve the recursive equation you answered in (A), and express
in Landau's notation. -
(C) We reduce the number of multiplications in the calculation in (A) by calculating
as . Express in Landau's notation, and prove it.
(1) 给定一个整数
-
(A) 令
。找到一个算法的时间复杂度(关于 ),该算法分别计算 ,然后计算 。 -
(B) 令
。注意 成立。找到一个算法的时间复杂度(关于 ),该算法计算 ,从而通过依次计算 得到 。
(2) 给定两个
-
(A)
位整数的乘法可以通过 位整数的乘法构造,如下所示: ,其中 。我们可以递归地应用这种缩减,直到每次乘法仅涉及足够小的整数以适应计算机的机器字。设 为两个 位整数相乘所需的机器字乘法次数。用 表示 。 -
(B) 解答你在 (A) 中回答的递归方程,并用 Landau 符号
表示 。 -
(C) 我们通过计算
为 来减少 (A) 中的乘法次数。用 Landau 符号 表示 ,并证明它。
Kai
(1)
(A)
First, consider calculating each term
-
To compute each
: - Computing
takes multiplications. - Therefore, the time to compute
is .
- Computing
-
Summing up the times for all
:
Thus, the overall time complexity is
(B)
The recurrence relation for
We calculate
- Calculating
takes . - Calculating
from involves one multiplication and one addition, so it takes . - Similarly, calculating each
from takes .
Since there are
(2)
(A)
Given:
where:
This involves four multiplications of
(B)
The recurrence relation is:
Let
Expanding this, we get:
Since
Therefore, in terms of
(C)
Using the optimized method for
This involves three multiplications of
Solving this recurrence relation similarly:
Since
Therefore, in terms of
knowledge
时间复杂度 递归 复杂度分析
重点词汇
- polynomial 多项式
- time complexity 时间复杂度
- recurrence relation 递归关系
- multiplication 乘法
参考资料
- Introduction to Algorithms, Cormen et al., Chap. 2 (时间复杂度分析)
- Introduction to Algorithms, Cormen et al., Chap. 30 (多项式和大整数运算)