Summary of the maximum minimum value------the divide-and-conquer algorithm

Source: Internet
Author: User

1. What is a divide-and-conquer algorithm:

When a big problem is not intuitive or even very difficult to solve, you can consider the big problem into a small problem, when the small problem is still difficult to solve directly, the small problem continues to transform into a smaller problem, until you can directly solve the problem.

2. Maximum minimum use divide and conquer the method to solve the idea:

Need to discuss: a. If the length of the array is only 1 or 2, the maximum minimum value is calculated directly compared.

B. If the length of the array is greater than 2, the direct solution seems a bit difficult, then, you can divide the array from the middle into a two part, if the length of a, B is still greater than 2, you need to continue to divide the array, until the length is less than or equal to 2. can be directly compared with step a method.

The following content for my own review, I feel this is more suitable for me.

I use the example myself, array={11,55,88,4,67,131,93,66};

The results of the output are as follows:

Happy, finally finished!

Summary of the maximum minimum value------the divide-and-conquer algorithm

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.