Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2007-10-26 14:57:26 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
1.Give  the order-of-Magnitude time efficiency (in THETA)                     
. J# b1 v" d! F: o0 x+ Q7 k  for the algorithm.                                                            
! g4 @- t4 @; Z! y( D! `                                                                                2 X) n/ d" `5 r0 |# P
                Step 1:get values for D1, D2,,,,,, Dn                           2 L) X0 b+ Z5 f+ H( a
                Step 2:get sum=0                                                $ C+ v6 B7 Z. Z  H7 \
                Step 3:set left=1                                               
4 Y" K7 y8 z# d* r/ \; f% B                Step 4:repeat Step 5 to 7 until left>N                          
) Y4 C( \; d7 K. V  ^- ]                Step 5: if Dleft  is positive then                              4 _& i5 d2 @- s1 D6 d* w
                Step 6:   set sum=sum+Dleft                                     : ~0 m5 d% {0 h* o  o5 i  ?  t9 T/ F
                Step 7:   set left=left+1                                       % b" }# X" U( `. }
                Step 8: print out sum as the answer     {; M6 F; K% z  k! `
/ S# I8 b4 j  H3 g

; U2 V8 |9 ~1 j% P3 h+ o2 z& _6 N$ v3 _8 b
2.Give the order-of-magnitude time efficiency(in THETA)                        & o% x' i. Q( s. {) I& R# I
  for the the algorithm.                                                        7 `* v! k/ M9 A
                                                                                
+ ~6 A, o% F. I8 v0 z7 r4 `. L& ~                Step 1:get values for L1, L2,….. Ln                           
8 k; D2 _. x" ?6 i                Step 2:set i=0                                                  
4 Q& J- E# e& T                Step 3:repeat Steps 4 to 8 until i>N                           
9 }' w4 E5 x; \7 i/ t; O3 m; l/ i                Step 4: set j=1                                                
' ]' b% L* N) g1 E% A+ \                Step 5: repeat Steps 6 and 7 until j>N                          
8 ^( x& J* b. R4 j; u0 G' v                Step 6:         print(LI,Lj)                                    ; \: b5 b! v. f- D
                Step 7:         add 1 to the value of j                         ) p* P( |* l0 ^! a. O! r
                Step 8: add 1 to the value      of i  
; `1 q  v: Q+ [* \/ i
, h& D' P% B# `# D3 R! i$ `  E求以上二題的時間複雜度
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 頂 踩 分享分享
2#
發表於 2007-10-26 22:40:23 | 只看該作者
時間複雜度
/ s+ p- B0 E# d' K  |1 Xhttp://content.edu.tw/senior/com ... algorithm/algo5.htm
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

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

GMT+8, 2025-2-23 07:40 AM , Processed in 0.162009 second(s), 17 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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