Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2007-10-26 14:57:26 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
1.Give  the order-of-Magnitude time efficiency (in THETA)                      4 G: k3 P8 x% K3 u
  for the algorithm.                                                            
! G2 ]/ `5 z+ a  P$ c                                                                                
8 I' [/ V' A" V* S2 Q+ `. ?6 M9 C                Step 1:get values for D1, D2,,,,,, Dn                           3 l# H6 [4 c4 e3 C" M# \3 s
                Step 2:get sum=0                                                
  {. j  o. _; D3 g5 k& c9 _9 M6 ]                Step 3:set left=1                                               2 j" D/ o2 D" e3 ~7 _/ ~" ?
                Step 4:repeat Step 5 to 7 until left>N                          
! F; A2 R8 r& ~# c8 _0 [* m                Step 5: if Dleft  is positive then                              2 A& ~, J  U+ l2 K9 A9 P8 e
                Step 6:   set sum=sum+Dleft                                    
' X, |8 R4 i8 K7 G                Step 7:   set left=left+1                                       
# Z( w/ g0 ]( r6 t+ R                Step 8: print out sum as the answer   
# v# F7 [. a" V1 \
( u0 H; a! w7 Y6 `6 N) b2 Y' p6 i& C/ r  w) a4 O% b! s" F

( r3 W2 N% u0 |* t. }8 n. @2.Give the order-of-magnitude time efficiency(in THETA)                        
2 x  [* I" K! z: ~5 l# k) g  for the the algorithm.                                                        1 \" P3 b) I4 _! ?
                                                                                
; s$ r0 F6 o" w: F0 Q! ]                Step 1:get values for L1, L2,….. Ln                           
1 D- D- I6 m+ Y6 ]; i  R& e2 s- X                Step 2:set i=0                                                  ; q& X& m/ n2 _3 E
                Step 3:repeat Steps 4 to 8 until i>N                           
" h  V( U' w0 P  C3 a                Step 4: set j=1                                                 . {. d6 O7 h& R/ U
                Step 5: repeat Steps 6 and 7 until j>N                          
. V4 A$ J% ^! q3 K4 m% Q3 g                Step 6:         print(LI,Lj)                                    8 E* ^. v( u4 o, r
                Step 7:         add 1 to the value of j                         * g# q0 K+ M2 l+ r6 ^' ]
                Step 8: add 1 to the value      of i  % @0 W* n  r/ O# c

' h' c; x+ ^% W$ ^- @( _# ~. l# @, y求以上二題的時間複雜度
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 頂 踩 分享分享
2#
發表於 2007-10-26 22:40:23 | 只看該作者
時間複雜度
1 |8 y1 c$ m" W( j9 T4 D9 i* Y' xhttp://content.edu.tw/senior/com ... algorithm/algo5.htm
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

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

GMT+8, 2024-6-16 11:12 PM , Processed in 0.117514 second(s), 17 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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