Reputation: 137
Master theorem can be used to solve recurrence relations like
T(n)= aT(n/b)+f(n)
.
So, if f(n)=O(n)
or if f(n)=cn
are both the values same?
can I use master theorem for f(n)=cn
also?
Upvotes: 3
Views: 355
Reputation: 17605
If I understood the question correctly, f(n)=cn
(where c
is a constant) is in O(n)
; the master theorem can be applied.
Upvotes: 2
Reputation: 13588
Asumming that c
is a constant and that I understand your question correctly, the solution will be the same for both f(n) = O(n)
and f(n) = cn
, since cn = O(n)
and thus the Master theorem can be applied to solve the recurrance.
Upvotes: 3