Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

[複製鏈接]
跳轉到指定樓層
1#
發表於 2007-10-26 14:57:26 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
1.Give  the order-of-Magnitude time efficiency (in THETA)                      - Z: l, V8 ]. E. P
  for the algorithm.                                                              @0 p  ~" `3 J" B. ?/ ~
                                                                                5 S+ k( h: ?; a: u! x( t
                Step 1:get values for D1, D2,,,,,, Dn                           
8 l! q9 C3 I. ^8 @+ q                Step 2:get sum=0                                                
: F9 W/ d7 G# M9 H                Step 3:set left=1                                               
0 |: ^4 Z( V# B* r                Step 4:repeat Step 5 to 7 until left>N                          ' t7 e* M  }/ e5 f5 U0 h
                Step 5: if Dleft  is positive then                              
. ^& Q' u3 j: m" M, k" C% P                Step 6:   set sum=sum+Dleft                                    
2 M5 z3 P' d9 u6 w, n4 z                Step 7:   set left=left+1                                       
5 @2 y! r5 V, ~                Step 8: print out sum as the answer   $ B: u( T" c8 |7 O: o

7 J% c& |9 d; m1 A: y
8 v: z1 I8 E5 q$ N3 M: y0 F6 r" A: P  ?2 c
2.Give the order-of-magnitude time efficiency(in THETA)                        ' ?8 A( q& h- s
  for the the algorithm.                                                        . s4 j7 o8 K+ Z/ n3 q/ W. U
                                                                                
6 X- y$ j( D2 g( I1 `$ `& Y                Step 1:get values for L1, L2,….. Ln                            ) y$ Y# f% I6 ]0 M4 T
                Step 2:set i=0                                                  : R% S, m( l+ J3 q; }
                Step 3:repeat Steps 4 to 8 until i>N                            3 Z+ W9 [. _6 [$ F% j5 m
                Step 4: set j=1                                                
5 E. a: X1 b7 S- G% d2 X1 W                Step 5: repeat Steps 6 and 7 until j>N                          + m' ?. \8 Z! u8 J
                Step 6:         print(LI,Lj)                                    ' O* ^; U% N# |% _: J
                Step 7:         add 1 to the value of j                         - O1 k% g5 _0 l+ h0 `
                Step 8: add 1 to the value      of i  
( m: F: f% o$ Z0 U; m
9 Z6 _2 X) c) _4 }$ G; E求以上二題的時間複雜度
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 頂 踩 分享分享
2#
發表於 2007-10-26 22:40:23 | 只看該作者
時間複雜度
8 |/ g0 G3 P7 L* e! F- n) ~- a2 Ehttp://content.edu.tw/senior/com ... algorithm/algo5.htm
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

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

GMT+8, 2024-6-4 12:32 AM , Processed in 0.117015 second(s), 17 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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