Divide and conquer the law

Source: Internet
Author: User

The basic idea of divide-and-conquer method is to decompose a problem of size n into K small sub-problem (preferably the size of sub-problem is roughly the same), these sub-problems are independent of each other and the same as the original problem, and then the solution of each sub-problem is merged into the solution of the original problem.

Divide-and-conquer (P)

{

if (| p| <= n0) adhoc (P);

Divide P into smaller subinstances

P1,p2,p3,p4.......,pk

for (i=1;i<=k;i++)

Yi=divide-and-conquer (Pi)

Return Merge (y1,y2,.... yk)
}

Among them | P| represents the size of the problem p, N0 is the threshold value, indicating that when the size of the problem p is not more than n0, the problem is easy to solve and no further decomposition. Adhoc (P) is a basic sub-algorithm in the Division and treatment method.

Divide and conquer the law

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.