Linear recursion of Reading Notes in the construction and interpretation of computer programs

Source: Internet
Author: User
Document directory
  • Difference between process and procedure in this book
  • Linear recursion

I am stupid. I am unaware of the "computing process" and "process" in the translated book. In the translation, process is translated into "computing process" and procedure is translated into "process ". Process is sometimes translated into "process ".

Difference between process and procedure in this book

Process is the process of processing a program in a computer. See row 1st, section 1st, page 1 of the translated book: "computational process is an abstraction that exists in computers. In its evolution and development, these processes (processes) operations on abstract things that are also called data. ".

Procedure describes the process in a programming language, that is, the source code of the program. See row 3rd on page 1 of the translated book: "The LISP description of the computing process is called procedures )".

After clarifying the differences between the two, read the recursive process and recursive procedure in section 1.2.

P.s. toplanguage has a master in the group talking about how to translate programming into "programming "? "Program Design )"? It is equally interesting. If there is a debate, there will be progress.

Linear recursion

Linear recursion is different from tree recursion. The difference between linear recursion and tree recursion can be seen in accumulate and factorial instances. For the "recursion" knowledge, the following references Dexter. yy's "recursion and Recursion: javascript in the final Recursion Method of Fibonacci numbers:

In the process of program execution, "recursion" refers to a method that breaks down large and complex problems into smaller and simpler problems and breaks them down step by step, the problem can be solved directly when it is small, and then traced back to the problem level by level until the initial problem is solved. The Recursive Computing process contains two stages: the first step is the expansion ), construct a chain consisting of deferred operations (stored in the stack by the interpreter) and perform those operations step by step in the contraction phase.

The Ackermann (Ackermann) function is a function named after the German digital family akeman. It is a fast linear growth in linear recursion. Answers to exercise 1.10 on the Internet

The following is the implementation of a program rewritten with javascript:

function A(x,y){    if(y==0)    {        return 0;    }    if(x==0)    {        return 2*y;    }    if(y==1)    {        return 2;    }    else{        return arguments.callee(x-1,arguments.callee(x,y-1));            }}

Implemented using a C # program:

using System;class TestCase{    static int A(int x, int y)    {        int sum = 0;        if(y==0)        {            return sum;        }        if(x==0)        {            sum = 2*y;            return sum;        }        if(y==1)        {            sum = 2;            return sum;        }        else        {            sum = A(x-1, A(x, y-1));            return sum;        }    }    static void Main()    {        Console.Write(A(1, 10));    }}
Related Article

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.