简体   繁体   English

的渐近运行时间是多少

[英]What is the asymptotic running time of

Can anyone help me check the correctness, and explain why 谁能帮我检查正确性,并解释原因

What is the asymptotic running time of T(n) = 3T(n/3) + O(n) with T(1) = 1   _______ .  

My answer is n log 3 3 . 我的答案是n log 3 3

You seem to have misapplied the Master Theorem . 您似乎错误地应用了主定理

We have T(n) = a T(n/b) + O(n) where a, b = 3 . 我们有T(n)= a T(n / b)+ O(n) ,其中a,b = 3

Since here the recurence function is O(n) , it takes the form O(n c log k (n)) with c = 1 and k = 0 . 由于此处递归函数为O(n) ,因此其形式为O(n c log k (n)),其中c = 1并且k = 0

We are thus in the case where c = log a (b) = 1 . 因此,在c = log a (b)= 1的情况下

Then according to the Master Theorem, the complexity is O(n c log k+1 (n)) , that is O(n log(n)) . 然后根据主定理,复杂度为O(n c log k + 1 (n)) ,即O(n log(n))

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

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