Algorithm
Finite description of steps for solving problem Problem types Satisfying ⇒ find any legal solution Optimization ⇒ find best solution (vs. cost metric)

Approaches
Iterative Recursive ⇒ execute action in loop ⇒ reapply action to subproblem(s)

Recursive Algorithm
Definition
An algorithm that calls itself

Approach
1. Solve small problem directly 2. Simplify large problem into 1 or more smaller

subproblem(s) & solve recursively 3. Calculate solution from solution(s) for subproblem

Algorithm Format
1. Base case Solve small problem directly 2. Recursive step Simplify problem into smaller subproblem(s) Recursively apply algorithm to subproblem(s) Calculate overall solution

Example – Find
To find an element in an array
Base case If array is empty, return false Recursive step If 1st element of array is given value, return true Skip 1st element and recur on remainder of array Example (See ArrayExamples.java)

Example – Count
To count # of elements in an array
Base case If array is empty, return 0 Recursive step Skip 1st element and recur on remainder of array Add 1 to result

To calculate factorial of n
Base case If n = 0, return 1 Recursive step Calculate the factorial of n-1 Return n × (the factorial of n-1)

Example – Factorial
Code
int fact ( int n ) { if ( n == 0 ) return 1; return n * fact(n-1); }

// base case // recursive step

Requirements
Must have
Small version of problem solvable without recursion Strategy to simplify problem into 1 or more smaller subproblems Ability to calculate overall solution from solution(s) to subproblem(s)

Making Recursion Work
Designing a correct recursive algorithm Verify
1. Base case is

Recognized correctly Solved correctly 2. Recursive case Solves 1 or more simpler subproblems Can calculate solution from solution(s) to subproblems

...Recursion is the procedure of solving a problem by breaking it down into a smaller version of itself. It is similar to factorial notation of a nonnegative number in algebra. Below are the equations that define algebraic factorial notation.
Equation 1: 0! = 1
Equation 2: n! = n * (n - 1)! If n > 0
These equations can be used to help define the concept of recursion in computer programming. A further explanation of them is needed to better understand how they can help. Equation 1 is known as the base case while equation 2 is known as the general case. Equation 1 contains no factorial notation while equation 2 is a smaller version of itself. These two equations are known as recursive definition. The following can be derived from recursive definition:
1. Every recursive definition must have one (or more) base cases.
2. The general case must eventually be reduced to a base case.
3. The base case stops the recursion. (Malik 357)
Using the information learned from above, a computer programmer can solve a problem by using a recursive algorithm or recursive function. A recursive algorithm has to have one or more base cases as well as the general solution being eventually reduced to a base case. A recursive function contains a statement that calls itself before the current call is completed. Recursive functions are used to implement recursive algorithms. Keep in mind that having a...

...The Property of Recursion in Birdsong and Human Language
Introduction:
Human speech and birdsong have numerous parallels. Both humans and songbirds learn their complex vocalizations early in life, exhibiting a strong dependence on hearing the adults they will imitate, as well as themselves as they practice, and a waning of this dependence as they mature. Innate predispositions for perceiving and learning the correct sounds exist in both groups, although more evidence of innate descriptions of species-specific signals exists in songbirds, where numerous species of vocal learners have been compared.
Both humans and songbirds have evolved a complex hierarchy of specialized forebrain areas in which motor and auditory centers interact closely, which control the lower vocal motor areas also found in non-learners. In both these, vocal learners; however, the processing of auditory feedback in these brain areas is surprisingly unclear.1
The idea builds upon Miyagawa’s conclusion, detailed in his previous work, that there are two “layers” in all human languages: an “expression” layer, which involves the changeable organization of sentences, and a “lexical” layer, which relates to the core content of a sentence. His conclusion is based on earlier work by linguists including Noam Chomsky, Kenneth Hale and Samuel Jay Keyser.
Based on an analysis of animal communication, and utilising Miyagawa’s framework, the authors say that birdsong closely resembles the...