001-algorithm-push Method

Source: Internet
Author: User
1. Concept: a recursive algorithm is a simple algorithm that uses known conditions to draw intermediate inferences from specific relationships until the results are obtained. Recurrence can be divided into push-down and push-back.

Recursive Algorithms use the "step-by-step" method to constantly use existing information to derive new things.

Pushdown method: it refers to the method to solve the problem step by step based on known conditions. For example, the Fibonacci sequence can be used to calculate new data through the forward method.

Inverse Method: based on known results, iterative expressions are used to calculate the conditions for a problem, that is, the inverse process of the forward method. Demo: http://blog.csdn.net/jtlyuan/article/details/7185110 eg: Fibonacci series code:
/*** @ Declare: it refers to the method to solve the problem step by step based on known conditions. <Br> * For example, the Fibonacci sequence can be used to calculate new data through the forward method. <Br> * @ Author: cphmvp * @ version: 1.0 * @ Date: 9:58:52, January 1, July 29, 2014 */public class recurrence {public int Fibonacci (int n) {int [] f = new int [N]; F [0] = 1; F [1] = 1; for (INT I = 2; I <N; I ++) {f [I] = f [I-1] + F [I-2];} return f [n-1];} public static void main (string [] ARGs) {recurrence = new recurrence (); int Fibonacci = recurrence. fibonacci (10); system. out. println (maid );}}

 

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.