Using Induction to design use inductive design algorithm [1/14]

Source: Internet
Author: User
 

Mathematical theorem proof and ComputerAlgorithmThe analogy between designs can provide an excellent method for algorithm design. By interpreting this method, we can understand this key idea and have a deeper understanding of it.

This articleArticleA mathematical induction-based method is presented during the design and teaching of composite algorithms. Although this method does not cover all possible methods when designing algorithms, however, it contains most of the known technical methods. At the same time, this method also provides an excellent and intuitive structure, so that it is more in-depth in interpreting algorithm design. The core of this method is to compare the two mental processes in the process of proving the mathematical theorem and designing the combined algorithm. Although we acknowledge that these two processes serve different purposes and achieve different types of results, they are more similar than they seem. This statement can be verified through a series of algorithm examples, which can be used for design and interpretation. We believe that by learning this method, students can have more enthusiasm for algorithms and have a deeper and better understanding of algorithms.

Mathematical induction is a very powerful proof method. Use the following: Let t be a theorem we want to prove. Suppose t contains a parameter n whose value can be any natural number. We do not need to directly prove that t is true for all N. We only need to prove the following two points: (1) T is true for n = 1 (2) for any n> 1, t is true for n-1. The first point is often easy to prove. It is easier to prove the second point in many cases than to prove the theorem directly, because at this point we can assume that t-to-n-1 has been established. (In a sense, we obtain this assumption unconditionally ). In other words, it is helpful to use a smaller N value for the scale of the reduction theorem instead of proving it from the beginning. We are concerned with this reduction.

This principle also applies to algorithms. Induction allows people to focus on extending from small subproblems to those larger problems. You can start with any instance of the problem and try to solve the problem by assuming that the same problem with a small scale has been solved. For example, given a sequence of n (n> 1) to sort it (it is not necessary to sort a sequence), we can assume that we already know how to sort n-1 numbers. Then we can either sort n-1 number and insert the nth number to the correct position (this leads to an algorithm called insert sorting ), you can either place the nth number in its final position at the beginning and then sort the remaining number (this leads to an algorithm called "sort by choice ). We only need to solve the operation on the nth number (of course, this is not the only sorting method, nor the only method to sort by induction ).

The example using induction described above is intuitive, and there are many different methods to use induction, resulting in different algorithm design techniques.

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.