Recursion
function Sums(S, A[1..n])
result = 0
for i from 1 to n
for j from i to n
if A[i]+A[j] = S
result = result + 1
return result
talk about | runtime |
---|---|
can | can not |
predict how it scales | predict actual runtime |
Big-O and
notation
Properties:
- ignore slow-growing things
- reason about relaative growth, e.g.,
and
should be the same
Definition
We shall say that if there exist
such that
for all
For an algorithm with runtime , is it true that
?
No, it just says the algorithm is NOT WORSE THAN .
网友评论