Divide and Conquer
Divide and conquer algorithms are a class of algorithms that solve problems by breaking them down into smaller, more manageable sub-problems, solving each sub-problem independently, and then combining their solutions to solve the original problem.
Here’s a general outline of how divide and conquer algorithms work:
Divide: Split the problem into smaller sub-problems of the same type.
Conquer: Solve each sub-problem recursively. If the sub-problems are small enough, solve them directly.
Combine: Merge the solutions of the sub-problems to form the solution to the original problem.
Example: Adding numbers
Recursion
Recursion is a process in which a function calls itself directly or indirectly to solve a problem. The concept of recursion is a pre-requisite skill for divide and conquer.
Recommended Chapter: Recursion
Last updated