討論串[理工] [資結]-時間複雜度
共 38 篇文章

推噓2(2推 0噓 1→)留言3則,0人參與, 最新作者joe1234wu時間16年前 (2009/12/04 23:29), 編輯資訊
0
0
0
內容預覽:
i=1:. 裡面while x初始值n 每次-1 直到扣到<=0. total: n次. i=2:. 裡面while x初始值n 每次-2 直到扣到<=0. total: [n/2]次. .. .. .. i=k:. 裡面while x初始值n 每次-k 直到扣到<=0. total: [n/k]次
(還有320個字)

推噓2(2推 0噓 1→)留言3則,0人參與, 最新作者CMJ0121 (請多指教!!)時間16年前 (2009/12/03 23:53), 編輯資訊
0
0
0
內容預覽:
首先我先確認 Foo函數是不是.... Foo( int n ). {. for i from 1 to n. {. x = n;. while x > 0 do. x = x - i;. end while. }. }. 所以全部運算次數為: Σ 上高斯(n/i). 故複雜度為 O(Σ 上高斯(n

推噓2(2推 0噓 2→)留言4則,0人參與, 最新作者NOtWorThy時間16年前 (2009/12/03 23:08), 編輯資訊
0
0
0
內容預覽:
Let T(n) be the running time of Foo(n). Find the order of T.. Foo(int n){. for i from 1 to n. x = n. while x > 0 do. x = x - i. }. 為什麼是O(nlgn)?. 不是O(n

推噓1(1推 0噓 0→)留言1則,0人參與, 最新作者FRAXIS (喔喔)時間16年前 (2009/11/21 00:37), 編輯資訊
0
0
0
內容預覽:
4^n = (2^2)^n = 2^2n = 2^O(n) > 3^n. 左右相除. 左右相除,用l'Hoptial's rule. 遞迴展開. T(n) = 4T(n/2) + n^2/lg n. = 16T(n/4) + 4(n/2)^2/(lg n-1) + n^2/lg n. = n^2 (

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者NOtWorThy時間16年前 (2009/11/21 00:05), 編輯資訊
0
0
0
內容預覽:
1) 3^n = 2^O(n) why is true ?. 2) 1 = o(1/n) why false ??. 3) show that (logn)^3 = O(n^(1/16)). 4) let T(n) = 4T(n/2) + n^2 / logn , T(c) = c if c < 2