Re: [理工] 资料结构 Big-O 计算

楼主: yorunohoshi (夜の星)   2016-04-18 16:00:23
※ 引述《garyhsu1209 (良师)》之铭言:
: 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
http://i.imgur.com/RET0Fp0.png
用Summation的作法不知道是不是长这样@@
j循环下有2个指令,接着j循环用一个sigma,i循环再用一个
计算到最后取big-oh
如有错误恳请指正 谢谢!
作者: gsmzxcvbnm   2016-04-23 00:45:00
真的看解答都很简单,看到类似的又不会写了

Links booklink

Contact Us: admin [ a t ] ucptt.com