Reputation: 1500
I completely understand Big O notation but while trying to learn karatsuba algorithm the following statement confused me
T(n) = 4T(n/2)+ O(n)
=>T(n) = O(n^2)
How O(n^2) running time is derived from the first statement?
Upvotes: 0
Views: 38
Reputation: 831
You have T(n) = aT(n / b) + O(n^c)
where a=4, b=2, c=1
then https://en.wikipedia.org/wiki/Master_theorem#Case_1
T(n) = O(n^log2(4)) = O(n^2)
Upvotes: 1