简体   繁体   English

递归函数 g(N) = (1/c)g(N/2) 的 Big-Theta(Θ)

[英]Big-Theta(Θ) of the recursive function g(N) = (1/c)g(N/2)

I'm trying to analyse the recursive function g(N) = (1/c)g(N/2), for N >= 2, with the terminating case being g(1) = 1, and then find the big-theta bounding it.我正在尝试分析递归函数 g(N) = (1/c)g(N/2),对于 N >= 2,终止情况为 g(1) = 1,然后找到大的-限制它的 theta。 Bare in mind, this problem treats n as if it were some power of 2, so N = 2 n for example, which means n = lg(N).请记住,这个问题将 n 视为 2 的某个幂,例如 N = 2 n ,这意味着 n = lg(N)。

What I found when doing this has me questioning whether or not I'm correct in my assumption.我在这样做时发现的东西让我怀疑我的假设是否正确。 The i th case expands to g(N) = (c -i )g(2 n - i ).第 i情况扩展为 g(N) = (c -i )g(2 n - i )。 Then set n - i = 0, making i = n and g(N) = (c -n )g(2 n - n ).然后设置 n - i = 0,使 i = n 和 g(N) = (c -n )g(2 n - n )。 Finally, g(2 0 ) = 1, so g(N) = c -n = c -lg(N) = N -lg(c) = (1/N) lg(c)最后,g(2 0 ) = 1,所以 g(N) = c -n = c -lg(N) = N -lg(c) = (1/N) lg(c)

What I gather out of this is that (1/N) p = Θ(0), since the limit of (1/N) p as N -> ∞ is equal to 0.我从中得出的结论是 (1/N) p = Θ(0),因为 (1/N) p作为 N -> ∞ 的极限等于 0。

I'm really just wondering if I'm doing this right, since in real world applications I wouldn't think it's possible to have an algorithm with a time complexity of 0.我真的只是想知道我这样做是否正确,因为在现实世界的应用程序中,我认为不可能有时间复杂度为 0 的算法。

You write你写

real world applications... algorithm with a time complexity...现实世界的应用......具有时间复杂度的算法......

so it seems that the recurrence g(n) = (1/c)g(n/2) stands for the running time of a real-world algorithm.所以似乎递归g(n) = (1/c)g(n/2)代表现实世界算法的运行时间。 As such, this makes sense only if 0 < c < 1 , since, otherwise, it's an algorithm that works faster on larger inputs, which doesn't make much sense in the real world.因此,这只有在0 < c < 1时才有意义,否则,它是一种在较大输入上运行速度更快的算法,这在现实世界中没有多大意义。

Your analysis makes sense, up to the point where you analyze Θ( -lg(c) ) , and decide this tends to 0. For the reasonable values of c , it naturally enough tends to infinity.您的分析是有道理的,直到您分析Θ( -lg(c) )并确定这趋于 0 为止。对于c的合理值,它自然趋于无穷大。

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

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