简体   繁体   English

如何用二次项解决递归关系

[英]How To Solve Recurrence Relation with a quadratic term

I'm trying to solve this recurrence relation. 我试图解决这个递推关系。 Here's what I've attempted so far, but I think I'm wrong. 下面是我到目前为止尝试,但我想我错了。 I would really appreciate some guidance. 我真的很感谢一些指导。

This is the recurrence relation I am trying to solve:- 2T(n^1/2) + C 这是递归关系我试图解决: - 2T(N ^ 1/2)+ C

T(n) = 2T(n^1/2) + C
2((2T(n^1/4)+C) + C
>> 4T(n^1/16) + 3C
>> 8T(n^1/256) + 6C

So I can formulate it into this algebraic expression:- 因此我可以将其表达为以下代数表达式:

 (2^k)T(n^(1/2^k)) + 2k

So to solve the recurrence relation, I simply say 所以要解决的递推关系,我简单说

n^(1/(2^k)) = 1
Therefore:-   2k = log (base n) 1
But this makes k = 0....

I don't think this is correct. 我认为这是不正确的。 Please advise me, I'd be delighted to get some assistance! 请告诉我,我很高兴获得一些帮助!

My try. 我的尝试。 (warn: I'm not sure substitution is the right thing to do here. Let's give a shot.) (警告:我不确定替代在这里是否正确。让我们试一下。)

Let's say that T(x) = 1 for x < 2 假设对于x <2, T(x) = 1

with T(1) is a no-go (see my comment), so maybe we can try to compute T(2) 与T(1)是一个不走的(见我的意见),所以也许我们可以尝试计算T(2)

T(2) = 2 * T(sqrt(2)) + C = 2 + C

now we search for k such that n^(1/2^k) = 2 + C 现在我们搜索k使得n^(1/2^k) = 2 + C

1/(2^k) = log_n(2 + C)       [base n log]
1/log_n(2 + C) = 2^k
log_(2 + C) n = 2^k          [1 / log_a b = log_b a]
lg n / lg (2 + C) = 2^k      [change-of-base]
c2 lg n = 2^k            [since lg (2 + C) is fixed we put c2 = 1 / lg (2 + C)]
k = lg (c2 * lg n) = (lg c2) + lg lg n
k = c3 + lg lg n         [since lg c2 is fixed]

now we substitute back k into T(N) = 2^k + 2k and we find 现在我们将k代入T(N) = 2^k + 2k ,我们发现

T(n) = 2^c3 * lg n + 2*c3 + lg lg n

now if we put togheter 现在,如果我们把togheter

T(n) = c1 lg n + c2 lg lg n

where c1 and c2 are fixed and different from the ones we used above. 其中c1和c2是固定的,从我们上面使用的不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM