Divide and Conquer
Last updated
Last updated
Divide the problem into multiple subproblems in smaller size.
Conquer the subproblems recursively; set a straight forward way for base case.
Combine the solutions to the subproblems into the solution for the original problem.
recurrence relation:
the number of subproblems in the recursion
the factor by which the subproblem size is reduced in each recursive call
andis asymptotically positive (positive for sufficiently large)
base case: is a constant whenis a constant
compare with and this will lead to three regimes (>, =, <)
in recursion tree, compare root with leaves and see which part dominates
more reference: CLRS book page 94