[问题] 几个程式的问题

楼主: irene6524 (Irene)   2013-07-13 00:28:09
安安,各位大大,想请问2题程式
1. What is the time complexity of T(n) defined below? Please justify your answer.
T(1) = 0
T(n) = 2T(n/2) + n n > 1.
这题应该怎么做???
2.#define M(a,b) a*b
int main(void)
{
int i = 5, j = 6;
printf(”i*j = %d”, M(i+1, j-2*2));
return 0;
}
这题答案为什么是7呢? 为什么不是12呢?
作者: mihs3124 (如钻石般璀灿)   0000-00-00 00:00:00
Problem 1 is buggy. If n is odd, what's n/2? x.5?for T(n), n \in 2^x, where X \in normal,T(n) = \theta (log_2 n) x nFor proof, u could use Math Induction.
作者: suhorng ( )   2013-07-13 00:39:00
第二题 i+1*j-2*2 => 5+1*6-2*2 先乘除后加减 => 7
楼主: irene6524 (Irene)   2013-07-13 00:47:00
恩恩,了解,感恩。
作者: devastate (但我不能放鸽...)   2013-07-16 12:45:00
第一题今天我刚在itunesU课程听到,是merge sort的分析

Links booklink

Contact Us: admin [ a t ] ucptt.com