The next question was about a recent university assignment. I would think the answer would be n ^ 2 + T (n-1), since I thought n ^ 2 would make it the asymptotic time complexity of O (n ^ 2). Where, as with T (n / 2) +1, its asymptotic time complexity would be O (log2 (n)).
The answers were returned, and the correct answer is T (n / 2) +1, however I can not understand why this is so.
Can someone explain to me why this is the worst time complexity of this algorithm? Perhaps my understanding of the complexity of time is simply incorrect.
n . , , k , , , . . Wikipedia, :
n
k
n , , T(n) = T(n / 2) + 1. , , x_0 = 10 * k , M , . , log(n), n^2 , - .
T(n) = T(n / 2) + 1
x_0 = 10 * k
M
log(n)
n^2
O (f (n))? , c * f (n), , , c.
kevmo O (log2 n). , n ≤ 10k, T (n) X. X ( 167 k ^ 3 , , ). n X + log2 (n). c = X, c * log2 (n).
, , O (log n) , , , , k = 10 000. , , O- .