This is about analysis of algorithms:
Say, the running time of a problem is:
T(n) = { 1, for n == 1 | T(n/3) + THETA(1), for n > 1}
Now, this is THETA(log base3 n)
But, if I use Master Method, I evaluate to THETA(log base2 n), using Case II
How am I supposed to get the correct answer from master method?
They’re the same. For any two bases
aandb,Θ(loga n) = Θ(logb n), so we usually don’t mention the base at all and just sayΘ(log n).This is because
loga n = (1 / logb a) * logb n, so they differ by a factor of1 / logb awhich is constant with respect ton.