Math note (1)-recurrent problems

Source: Internet
Author: User

This part focuses on three recursive problems: Tower of Hanoi, plane segmentation, and Joseph ring. These three problems are common. Their novelty lies in the analysis hypothesis and rigorous proof of the problem, in particular, the third issue was analyzed in depth.

I. The tower of Hanoi

Assume that there are three columns A, B, and C, and N plates (sorted from big to small) are moved from A to B and there is no such situation in the middle of the tray. This problem is easy to come up with a recursive solution. If we set the minimum number of steps required to move n plates from one pillar to another, we conclude that, but how can we prove this is the best? It can be converted into the following two steps.

1. Proof. This is easy to do. We can move n-1 dishes to the C (), then the largest disk to B (1), and finally the n-1 disks in C to B (), that is, it can always be done in time.

2. Proof. If you want to move the largest disk, you must move n-1 disks to C () at least once. Since each disk can be moved any time between the empty column and a During the moving process, it may be greater.

In conclusion, our conclusions are easily known by mathematical induction.

2. lines in the plane

N straight lines can divide a plane into several parts at most. We can set n straight lines to divide at most the number of planes, which is easy to know. Considering the increase of the plane, it is necessary to add K to the area in the n-line condition that it separates K old areas, it separates K of an old region, and the necessary condition is that it and an existing line intersect at a different point in the K-1. The maximum value of Yi Zhi K is N, so we get the upper limit:

If we make the n-th line not intersect with any other line and no intersection exists, then the equal sign can exist. We can obtain the so-called close form:, where n is a positive integer by means of expansion and inverse itself.

The following shows the deformation. N broken lines can divide the plane into a maximum of several areas. We use it to represent, easy to know. Considering a single line, it has two intervals less than two straight lines, for example:


If we place the line reasonably so that the turning point of the line falls under the intersection of all straight lines (including dotted lines), then each line has two areas less than a straight line, that is, A feasible placement scheme is as follows: a line can be placed on the left of a point, but the slope of both sides must be smaller than AB. Similarly, a line can be placed on the right of M point.

III. The Joseph ProblemThis is also a classic problem. The author first analyzes the problem from a simple situation: n (1 to n) People are grouped into a circle, and each time they are removed as 2 people, find the last surviving person. 1. Based on the parity of the total number of people, it is not difficult to obtain a recursive expression when the cycle is one week later: when finding the close form of this expression, we can first list the situations where N is relatively small (1-16). We can find the magic law: when we represent N in another form: Where is the maximum 2 Index of N, then. According to the above
It is easy to come to this conclusion by mathematical induction. 2. Study the relationship between the above conclusions and N from the binary perspective. We represent N as binary, where 0 or 1 and 1. In the following example, 2L + 1 and J (n) are represented in binary as follows, that is, we can get J (n) by moving n to the left of the loop ). If we iterate J (...) cyclically, The result remains unchanged after a finite number of iterations. If the value of V (n) is n binary, it indicates the number of 1. After a finite iteration, the result is. 3. Extend to the general situation and analyze its close form. As shown in the following formula: from the analysis of N small cases (1-9), we can know that the coefficient of the result is the maximum index of 2 of N, and the coefficient decreases to 0 in sequence, the coefficients increase progressively from 0. If we write F (n) in this form: we assume that it is not hard to prove this by mathematical induction. Calculate the three coefficients in the F (n) expression using the undetermined coefficient method. Since they are only related to N, we can use the original recursive expression. Then we use simple F (n) to explore more restrictions that the three parameters should meet, we can calculate F (n) = 1 by bringing the recursive expression, and then obtain a (n)-B (n)-C (n) = 1 according to the F (n) expression, similarly, if we take F (n) = N, we can get the constraint of the coefficient as follows: We can also get our conclusion. This is what the author calls the Repertoire method.

We also use binary ideas to explore the relationship between common Joseph problems. First, we represent the recursive form as follows :,
In this example, expand recursion, And we will write it into a binary format similar to that (not all values are 0 or 1 ). For our original Joseph's problem, we can get the result by moving one bit left of the loop, because the binary number of N represents the binary number of each block (which may contain multiple blocks) with the extension solution, and it is equal to, all such blocks are shifted to one by one, which is equivalent to shifted to the other by N cycles.

To extend to a more general situation, consider:

We can draw a similar conclusion.

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.