English 中文(简体)
弥补这种休养职能时间复杂性的困难
原标题:Difficulty figuring out the time complexity of this recursive function

我认为这令人感兴趣,但我不相信我的解决办法。 该算法计算了xn

如果我使用主人的话,我的推理就是这样。

T(n) = 2 T(n/2) + f(n)

但是,本案中的(n)是1? 因为n <=4不变。 我:

T(n) = Θ(n)

如果我使用替代方法,我就获得这一答案。

T(n) = Θ(n + log(n))

我认为,我做许多事情是错误的。 谁能把我引向正确方向?

问题回答

T(n) = Θ(n +log(n))仅为T(n)=Θ(n)。 在使用“ta”时,可以省略较低的定级词(log(n)。

Also, f(n) is O(1) because you are only doing one multiplication (rek(x, n/2) * rek(x, (n + 1)/2)) for each recursion.

复杂程度为0(n)。 解释: 你使使用简单周期的工作出现重复。 你们没有任何行动,按人数分列的数字* 大于一个集团。 因此,复杂性在于使0(n)的混凝土。





相关问题
Which recursive formula is more complex?

T(n) = 4T(n/2) + n = O(n2) using master theorem. Is the above more complex than the one below? T(n) = 3T(n/4) + n2 both are O(n2) using master theorem, but I do not know how to check the constant.

Using the master theorem

Use the master theorem to put O() bounds on this statement: T(n) = 16T(n/4) + n2 + log n I m trying to understand the master theorem more and more and trying to find more examples online and getting ...

1. 主要方法?

我先从麻省理工学院的开放式课程网站观看一些视频讲座,在第三场讲座录像上,讲师超越了收复矩阵的多重复性,而且时间复杂......

Why is a constant added in case 3?

In the Master Theorem, cases 1 & 3 you have if f(n) = O(log b of a-e) in case 1, I wondered why one has to subtract the constant e there? In the third case of the master theorem one has to add a ...

热门标签