📜  门| GATE-CS-2003 |第90章

📅  最后修改于: 2021-07-02 16:53:08             🧑  作者: Mango

考虑以下递归关系
GATECS2003Q35
m≥1的T(m 2 )的值为
(A) (m / 6)(21m – 39)+ 4
(B) (m / 6)(4m 2 – 3m + 5)
(C) (m / 2)(m 2.5 – 11m + 20)– 5
(D) (m / 6)(5m 3 – 34m 2 + 137m – 104)+(5/6)答案: (B)
解释:

One easy way to solve this is to try putting different 
values of m.

For example, we know T(1) = 1. If we put m = 1, only A
and B satisfy the result.

m = 2

T(2) = T(1) + 1 = 2
T(3) = T(2) + 1 = 3
T(4) = T(3) + 2 = 5

Both A & B produce 5

m = 3
T(9) = T(4) + 2*5 + 1 = 5 + 10 + 1 = 16
Both A & B produce 16

m = 4
T(16) = T(9) + 3*7 + 1 = 16 + 21 + 1 = 38
Only B produces 38, A produces 34 which doesn't match 

这个问题的测验