[問題] 幾個程式的問題

看板CSSE (電腦科學及軟體工程)作者 (Irene)時間11年前 (2013/07/13 00:28), 編輯推噓2(205)
留言7則, 4人參與, 最新討論串1/1
安安,各位大大,想請問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呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 121.254.127.79

07/13 00:39, , 1F
第二題 i+1*j-2*2 => 5+1*6-2*2 先乘除後加減 => 7
07/13 00:39, 1F

07/13 00:47, , 2F
恩恩,了解,感恩。
07/13 00:47, 2F

07/16 12:45, , 3F
第一題今天我剛在itunesU課程聽到,是merge sort的分析
07/16 12:45, 3F

10/20 12:21, , 4F
Problem 1 is buggy. If n is odd, what's n/2? x.5?
10/20 12:21, 4F

10/20 12:26, , 5F
for T(n), n \in 2^x, where X \in normal,
10/20 12:26, 5F

10/20 12:28, , 6F
T(n) = \theta (log_2 n) x n
10/20 12:28, 6F

10/20 12:31, , 7F
For proof, u could use Math Induction.
10/20 12:31, 7F
文章代碼(AID): #1Hu2wRIC (CSSE)
文章代碼(AID): #1Hu2wRIC (CSSE)