-
Recursive Functions and Data
-
Integer Exponentiation
- ADV: identify other cases and work more efficiently
-
Greatest Common Divisor(GCD)
- Eucid's Algorithm: gcd(132, 20) = gcd(20, 12)
- Directory Crawler
-
Helper Methods
- 2-methods approach
- dividing the recursive method into a pub and pri
-
CS: Prefix Evaluator
-
Infix, prefix and postfix notation
- infix notation is the only notation need ()
-
evaluating prefix expressions
-
A better Example of recursion
-
the sequence of the recursive case and the perform method is very important
- recursive case first: reverse
- perform method first: sequence
-
Thinking Recursively
-
basic
- Iteration
- Recursion
- A Nonprogramming Example
-
An iterative solution converted to recursion
- recursive is like a person in the line
- hold the method. After each one
- finish the method in hand, we get the
- result
-
Structure of Recursive Solution
-
base case
- solved immediately
- like a end of loop
- at least one
-
recursive case
- reduce problem to simpler problem
- solved by recursive call
- at least one
- if {base} else {recursive case}