Download presentation
Presentation is loading. Please wait.
1
PS2-Slides Function Call Diagram
2
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)); }
3
PS2-Slides
6
Stack Frames
7
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; }
8
PS2-Slides
11
The Towers of Hanoi
12
PS2-Slides The Towers of Hanoi 2
13
PS2-Slides
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.