Recursive algorithm in layman's one: Recursive theory overview and common recursive algorithm list

Source: Internet
Author: User
Tags comments
Preface

Recursion can be said to be a lot of basic programmers even have a certain development ability programmer including me this side of the pain point and itch point . But one sentence is classic:

Come out and mix, sooner or later.
The knowledge you have now skipped will be made up later (unless it is replaced).

So, I have to follow the ^_\^.
Therefore, I will write some of my own summary to share with you, have comments , suggestions of friends trouble Mercy leave a message , after all, a number of comments for reference, thank you.

This article old cat original, reproduced please add this article connection: http://blog.csdn.net/nthack5730/article/details/65537530
More articles about the old cat: http://blog.csdn.net/nthack5730 what is recursion

  Simply put: Recursion is the program constantly call itself, recursive method is the method of direct or indirect call itself, recursion is a very useful program design technology. recursion has two major characteristics: the repeated execution of the process (call itself) to end the repeated execution of the condition (method jumping point) recursive disadvantage:

memory consumption, resource consumption, difficult to read. Difficult to read. Difficult to read. (important thing to say three times) recursive design

A recursive call can lead to more recursive calls, because this method continues to decompose each sub-problem into a new sub-problem, and to terminate a recursive method, the problem must finally reach a termination condition . When the problem reaches this termination condition, the result is returned to the caller. The caller then computes and backs the result back to its caller. This process continues, knowing that the result is passed to the original caller's bit. A recursive design usually consists of two parts: 1. Recursive definition: Transform large problems into small problem solving.

Recursive definition is the decomposition of the problem, the decomposition of a problem into a small problem and the same program to solve. 2. Recursive termination condition: jumps out of recursion and returns the solution of the smallest problem.

The recursive termination condition is usually the solution to the smallest problem and is returned to his caller. using recursion to solve problems all recursive programs have a feature: These methods use IF-ELSE or switch statements to guide different situations one or more underlying situations (the simplest case) used to terminate recursion. Each recursion simplifies the original problem , keeping it close to the basics and knowing that it becomes the underlying condition (the smallest problem).
  
In general, to solve a problem by using recursion, it is necessary to decompose the problem into sub-problems. Each sub-problem is almost the same as the original problem, but smaller in size. You can apply the same method (program) to solve sub-problems recursively. recursive common Algorithms and applications:

  I will continue to learn, with you to share the recursive common algorithms and applications, will slowly in this article to complement the link:
1. Recursive algorithm in layman's two: factorial of recursive n
2. Recursive algorithm in layman's three: recursive Fibonacci Fibonacci sequence
3. Recursive algorithm in four ways: recursive judgement palindrome string and recursive auxiliary method
4. Recursive algorithm in five: Deep search to find the shortest path of course, but also the top of everyone, I can more power yo.

This article old cat original, reproduced please add this article connection: http://blog.csdn.net/nthack5730/article/details/65537530
More articles on Old cats: http://blog.csdn.net/nthack5730

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.