PS2-Slides Function Call Diagram
PS2-Slides int Factorial(int n) { if(n == 0){ return 1; } else { return n*Factorial(n-1); } int main(void) x{ printf("%d! = %d",4,Factorial(4)); }
PS2-Slides
Stack Frames
PS2-Slides Recursive vs Iterative Functions. int Recursive_Function (int n) { if (base_case) return something; else (some_work AND call Recursive_Function(n-1)) } int Iterative_Function (int n) {int m = initial_value; while (condition_based_on m) (m = update(m)); return m; }
PS2-Slides
The Towers of Hanoi
PS2-Slides The Towers of Hanoi 2
PS2-Slides