Outline:
A function is defined
recursively if some value of f(n)
is given (like f(0)) and the
value of f(n+1)is
given in terms of f(n).
Factorial:
f(0) = 1
f(n
+ 1) = f(n) * (n+1)
Activation record - maintains the current state of method execution.
Created for each invokation of a method. The current method is visible; its caller is next in the stack; its caller is next; until you reach main.
Contains
Simulating the activation record
Most easily done with "cards" or boxes on a piece of paper. For each method call, you add a new card to the top of the stack(noting on the original card your return point). The top card always represents the currently executing method.
Palindromes - Words that have the same letters from left to right or right to left.
Examples
Note - Non-letters are ignored. Case is ignored.
Department of Computer Science | Nancy Harris Home Page | Current Classes Link |