分而治之算法
什么是分而治之算法? (不,这不是“分而治之”) (What are Divide and Conquer Algorithms? (And no, it's not "Divide and Concur"))
Divide and Conquer is an algorithmic paradigm (sometimes mistakenly called "Divide and Concur" - a funny and apt name), similar to Greedy and Dynamic Programming. A typical Divide and Conquer algorithm solves a problem using the following three steps.
“分而治之”是一种算法范式(有时被错误地称为“ Divide and Concur”(一个有趣且恰当的名称)),类似于“贪婪和动态编程”。 典型的分而治之算法使用以下三个步骤来解决问题。
Divide: Break the given problem into subproblems of same type. This step involves breaking the problem into smaller sub-problems. Sub-problems should represent a part of the original problem. This step generally takes a recursive approach to divide the problem until no sub-problem is further divisible. At this stage, sub-problems become atomic in nature but still represent some part of the actual problem.
划分 :将给定问题分解为相同类型的子问题。 此步骤涉及将问题分解为较小的子问题。 子问题应该代表原始问题的一部分。 此步骤通常采用递归方法来划分问题,直到没有子问题可以进一步分割为止。 在这个阶段,子问题本质上已成为原子问题,但仍代表实际问题的一部分。
Conquer: Recursively solve these sub-problems. This step receives a lot of smaller sub-problems to be solved. Generally, at this level, the problems are considered &