According to the arrangement of the yellow book, it is time to be recursive. I checked the Internet. About "recursive" article can say "Khan Niu Changtong" - Please forgive me for getting sour, I mean, writing something about others, let everyone see, just wasting everyone, so I The following things should be some at least I look new, if you think there is something unclear, please refer to the relevant article (too much). Even so, this article still can't write what I want to say, it seems that I really have nonsense habits.
I have seen such a question, ask, "the three infrastructure, order, selection, and loops of program structured design?" Of course, you know such an argument, as long as there is these three, you can't Less? The answer is "can" because the recursive can replace the role, such as the following function to the elements in an array:
Float Rsum (Float A [], Const Int n)
{
IF (n <= 0) returnograph;
Else Return RSUM (A, N - 1) a [N - 1];
}
In fact, it is:
SUM = 0;
For (int i = 0; i However, the actual situation is that there is a loop structure in any language, but it is not a language that is recursive; with one sentence, recursion is universal, but not recursive is not 10,000. However, I see some people in the present, whether there is any problem, it is necessary to recurquity, clear loop is the first way to think, and the bias pays the brain to find the recursive algorithm. In this regard, I really don't know what to say. Is recursive a algorithm? Often see "Recursive Algorithm", "Non-intended Algorithm", which doesn't have a semantic issue, and I use it myself - recursive algorithm. But this is also explained, it is not an algorithm. He is a kind of thinking, because of an algorithm's guiding ideology is recursive, so it is called a recursive algorithm; and a problem with recursive algorithm, when you don't use it Retrieving as guiding ideas, the algorithm obtained is a non-incoming algorithm. - The problem of cycling can be handled, in this sense, the cyclic algorithm can be referred to as a non-code algorithm. I don't mean anything else in this bite, just want everyone to know, what kind of algorithm can be written, the key is to see your guiding ideology when you write algorithms. If you think of loop, iterative method, you will be able to find any recursive algorithm - even if you find a seemingly "simple" algorithm, because his low efficiency is actually waste - you are still What is this useless? Typical learning habits. If you just think of a recursive method, now you want to use the stack to digest the recursive, the work you do is just doing your system yourself, how much can you increase efficiency? Blind superstition digestion will be able to improve efficiency is unfounded - the method you do if you don't have justice, or even the original practice. Beginning from the classroom, the step I know is this like N! = 1 × 2 × ... n. If I let me write the algorithm of the multiplication, I will only think of multiplying from 1 to n. For another example, the fipholic causal number, if someone is described in natural language, it must be like this, starting two items 0, 1, and each item will be two times in front. So let me write the iterative solution to "the first two items to save, and then add results". - Now that it is to come to recurrent almost there is their debut, the beauty name: "Definition is recursive, so we write the algorithm." What I want to ask is where the defined recursive abstraction comes from? Obviously, the definition of the step is abstract from a loop process, and the definition of the Fiboacci number is an iterative abstraction. So, we will first abstract a recursive definition from a truth that is not recursive, then we say, "Because the definition of the problem is recursive, we can easily write the recursive algorithm", then say, "We can also The recursive algorithm is transformed into a cycle, iterative algorithm, "giving people feel like 1 ÷ 3 = 0.33 ..., 0.33 ... × 3 = 0.99 ......, then we spent a big mind to understand 1 = 0.99 ...... . There is still some people who are so tired. If you talk about recursive, you should mention these two. As a result, there is no student to see the definition of the step, no one is admired with the recursive step-up function - What is it? So, if you want to recipient, you will have a convincing example, and this example is non-Hano Tamo.