A problem that can be solved by a non-recursive algorithm in n^2
times. The same problem can be solved using a recursive algorithm in n lg(n)
operations to divide the input into two equal pieces and lg(n)
operations to combine the
two solutions together. Which algorithm do you think is more efficient?
EDIT: Base case: T(n) = 1 if n = 1.
This means that nlgn lgn
will be more efficient than n^2
. Right?