[理工] DS 时间复杂度

楼主: j897495 (咪咪)   2014-12-23 01:27:24
(1)Time for merge-sort can be modeled as the recursion T(n)=2T(n/2)+cn
that has solution theta(nlogn).And balance recursion achieves the best result.
Thus the lower bound to sorting problem is Omega(nlogn).
这个叙述错在哪呢?
Merge-sort的best/average/worst case 都是O(nlogn)没错
所以是因为是theta的关系吗?
(2)
long f (long n){
if (n<1) return 0;
if (n<3) return 1;
return f(n-1)+f(n-2);
}
The number of recursive calls grows exponentially with n
这句话的意思是 O(2^n)对吗?
这和费氏数列的时间复杂度应该是一样的
(3)
6(n^3)/(logn+1)的时间复杂度为什么是n^3次呢?
logn跟n^3比太小可以忽略吗??
希望有人能给个指点谢谢!!
作者: FRAXIS (喔喔)   2014-12-23 02:38:00
(1) 是错在这跟 lower bound一点关系都没有..(2) 他是说时间复杂度是c^n, c是一个常数未必是2..(3) 应该是O(n^3) 但是不会是Θ(n^3)
楼主: j897495 (咪咪)   2014-12-23 02:48:00
请问什么是lower bound@@不是下界的意思吗
作者: FRAXIS (喔喔)   2014-12-23 03:52:00
他的叙述每一句 你分开来看都是对的但是前两句不会 imply 第三句
楼主: j897495 (咪咪)   2014-12-23 09:33:00
懂了谢谢你!
作者: galapous (墨)   2014-12-23 10:12:00
第二题是false?
楼主: j897495 (咪咪)   2014-12-23 12:27:00
是true 只是不太懂表示的意思
作者: galapous (墨)   2014-12-23 12:44:00
喔喔,3q

Links booklink

Contact Us: admin [ a t ] ucptt.com