[理工] 資料結構 Big-O 計算

看板Grad-ProbAsk作者 (良師)時間9年前 (2016/04/18 11:38), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/2 (看更多)
give a big-O estimate for the number of operations (where an operation is an addition or a multiplication) used in this segment of an algorithm. Try to give the tightest possible polynominal function. 1. t:=1 2. for i=n to n^2 do 3. for j=1 to n^300 do 4. t:= t+t+1000 5. t = t+100 6. end for 7. t:= t+t 8. t = t+7 9. end for -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.25.105 ※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1460950708.A.C2E.html

04/18 12:16, , 1F
O(n^302)
04/18 12:16, 1F
文章代碼(AID): #1N55Qqmk (Grad-ProbAsk)
文章代碼(AID): #1N55Qqmk (Grad-ProbAsk)