Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

搜索
1 2 3 4
查看: 4387|回復: 1
打印 上一主題 下一主題

[問題求助] 請問二題時間複雜度的問題

[複製鏈接]
跳轉到指定樓層
1#
發表於 2007-10-26 14:57:26 | 只看該作者 回帖獎勵 |正序瀏覽 |閱讀模式
1.Give  the order-of-Magnitude time efficiency (in THETA)                     
* }( k9 P* b9 y+ S  for the algorithm.                                                            0 ~) W) G" h! q5 m# `" x6 [1 r9 o
                                                                                
) Z8 }: J) i$ _/ {7 i; b                Step 1:get values for D1, D2,,,,,, Dn                           
: Z- _& X2 a6 @6 Y* g                Step 2:get sum=0                                                
+ p+ A5 O' |# q& w1 q2 {8 O" _7 }                Step 3:set left=1                                               1 t5 p6 T; y/ |3 F' T
                Step 4:repeat Step 5 to 7 until left>N                          $ G( v- H" J8 X* h' v" z
                Step 5: if Dleft  is positive then                              % S1 A# V$ q) T9 d; J* O% y
                Step 6:   set sum=sum+Dleft                                     2 d: \% O; K5 O- A9 C' p. P% t7 s
                Step 7:   set left=left+1                                       
+ `& U3 t% L8 B0 x; |2 Q                Step 8: print out sum as the answer   
! A. t) X- c/ I( f" t; M/ J  `5 c' Z# g5 i8 ~$ Y
2 A  Y) \. U: ~$ e4 b: |
* G& Z$ v$ \5 h% ~5 P( s' V
2.Give the order-of-magnitude time efficiency(in THETA)                        
' l/ }- u& q' o# [! R  for the the algorithm.                                                        6 u: [0 @+ m' v3 ~* i
                                                                                
: t" t% ]( i7 R, X. E) K# n                Step 1:get values for L1, L2,….. Ln                            5 w9 z; \+ F( t' [
                Step 2:set i=0                                                  
  C! z4 V+ i. e                Step 3:repeat Steps 4 to 8 until i>N                           
3 r' @, I- S+ v4 P& ^! ?                Step 4: set j=1                                                 ( e1 k5 C. M  W  [9 C
                Step 5: repeat Steps 6 and 7 until j>N                          - i' ?8 N% ^( d% g- G  T8 \# D
                Step 6:         print(LI,Lj)                                    
& D( [5 U+ N8 d$ j                Step 7:         add 1 to the value of j                        
# l  A: a8 ]! z+ ?                Step 8: add 1 to the value      of i  
/ H7 a6 j. Z1 _% u" z- g$ G! Z
. w( ^  m; n" |2 Q9 S1 V求以上二題的時間複雜度
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 頂 踩 分享分享
2#
發表於 2007-10-26 22:40:23 | 只看該作者
時間複雜度
& G  F% ~4 r/ F( \) S8 Lhttp://content.edu.tw/senior/com ... algorithm/algo5.htm
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

首頁|手機版|Chip123 科技應用創新平台 |新契機國際商機整合股份有限公司

GMT+8, 2024-5-31 03:22 PM , Processed in 0.139018 second(s), 18 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表