Comp 388-005 Week 3
Lewis Tower 415, 4:15-8:15
Start with recursive Fibonacci
Readings:
Bailey chapter 6, on Sorting
Sorting notes
Recursion notes
Topics in brief
- Recursion
- Factorial
- Fibonacci
- Induction
- Postage
- Expressions
Start with tail-recursion in recursion.html.
in-class lab
Answer-cache implementation of Fibonacci(n):
public static long
rfibonacci(int N) {
if (N<=1) return 1;
if rfibonacci(N) is in the answer
cache, return answer_cache[N]
return rfibonacci1(N-2) +
rfibonacci1(N-1); // but put result
into answer_cache[N] first
}
in-class lab
Get expr_assign.cs (with oneline_tokenizer.cs) to run
Hashing: lists.html#hashing
in-class lab: GetHashCode() values of strings in lab1