NOTE

3.4 Divide and Conquer

Divide a problem into smaller subproblems, solve them, and derive the original solution.

Data Structures & AlgorithmsCreated Updated 1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. What It Is

  • Divide the original problem into several smaller subproblems (the subproblems have the same structure as the original problem, only at a smaller scale)
  • Keep dividing the subproblems into smaller subproblems until they can no longer be divided (until the subproblem solutions can be calculated easily)
  • Use the solutions of the subproblems to derive the solution to the original problem

1.1. Recursion

  • Divide and conquer is suitable for recursive implementation, and the Master Theorem can be used for complexity analysis
  • Recursion.md

2. Example

2.1. Maximum Contiguous Subarray Sum

3. References

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub