Suppose we have a recursive function, ,
What is the best asymptotic bound for ?
Bonus: Can you describe a well known algorithm that has a recurrence that looks like this?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Since we have the recurrence, all that remains to do is solve it using the master method .
We can see from the given function that a = 2 , b = 2 , c = 1 , f ( n ) ∈ O ( n ) . This falls under case 2, as we have lo g b a = c . Since we can rewrite O ( n ) as O ( n 1 lo g 0 n ) , it follows that the upper bound is O ( n 1 lo g 0 + 1 n ) = O ( n lo g n ) .
An algorithm with this recurrence that many may be familiar with is the merge sort, though others exist! See if you can come up with another similar algorithm.