sum_{k=a}^b f(i)
f(a) + f(a + 1) + ... + f(b)
, a^b
, a
, b
- .
p
, C^p < n <= C^{p+1}
, . i
1, C, C^2, C^3, ..., C^p
, C^k
k=0, ..., p
. , k
i = C^k
. , T
( ):
T = C^0 + C^1 + ... + C^p = sum_{k=0}^p C^k = (C^{p + 1} - 1) / (C - 1)
. , p
, :
p < log_C(n) <= p+1
, , p
:
log_C(n) - 1 <= p < log_C(n)
x -> (C^{x + 1} - 1) / (C - 1)
:
(n - 1) / (c - 1) <= (C^{p + 1} - 1) / (C - 1) = T < (Cn - 1) / (c - 1)
T
O(n)
(, , Theta(n)
) . , O(n)
(, , Theta(n)
, , ).