[問題] 幾個程式的問題

作者: 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