Computing Students - Computer Science Degree Notes
Home Contact Shop Notes Questions Programming Links Dictionary Coursework FORUM Tutors
  Recommended Kelkoo Searches: Computer Science | Computing | Computer Systems | Database | Computing Revision  

Notes > Models of Computation > Recursion

Recursion is a prominent feature of many programming languages and it enables an operation to be described in terms of itself with a halt condition that stops the execution of the code if it is satisfied.

The typical example to demonstrate recursion is the factorial function. This function takes a natural number (N), and returns the product of N and all smaller positive integers.

    5! = 5*4*3*2*1 = 120
    4! = 4*3*2*1 = 24
    3! = 3*2*1 = 6
    2! = 2*1 = 2
    1! = 1
    0! = 1
A common method of simplification is to divide a problem into subproblems and in computer programming this is a very important part of designing many important algorithms.

When a recursive function is called, the computer keeps track of the various instances/states of the function. This is typically done by using a stack. Many operations involving tree data structures also use recursion.

Search for "Recursion" on: Google | Kelkoo | Amazon | eBay (UK) | eBay (US)

Search for "Recursion" on the rest of Computing Students: Recursion






Home | Contact | Shop | Notes | Questions | Programming | Links | Dictionary | Coursework | Tutors Sponsored Links: Affiliate Program Articles | Computer Science Definitions | CS Degree Notes
Copyright © 2005-2006 ComputingStudents.com
This site is to be used in accordance with the ComputingStudents.com User Agreement
Acuras Website and Online Database Development and Management