Presentation is loading. Please wait.

Presentation is loading. Please wait.

Recursion Data Structures & Problem Solving Using JAVA Second Edition Mark Allen Weiss Chapter 7 © 2002 Addison Wesley.

Similar presentations


Presentation on theme: "Recursion Data Structures & Problem Solving Using JAVA Second Edition Mark Allen Weiss Chapter 7 © 2002 Addison Wesley."— Presentation transcript:

1 Recursion Data Structures & Problem Solving Using JAVA Second Edition Mark Allen Weiss Chapter 7 © 2002 Addison Wesley

2 Figure 7.5 A stack of activation records Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

3 Figure 7.7 A trace of the recursive calculation of the Fibonacci numbers Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

4 Figure 7.8 A tree viewed recursively Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

5 Figure 7.9 A tree Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

6 Figure 7.12 A recursively drawn ruler Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

7 Figure 7.14 (a) A fractal star outline drawn by the code shown in Figure 7.15 (b) The same star immediately before the last square is added Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

8 Figure 7.19 Dividing the maximum contiguous subsequence problem into halves Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

9 Figure 7.21 Trace of recursive calls for recursive maximum contiguous subsequence sum algorithm for N = 8 elements Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

10 Figure 7.22 Some of the subproblems solved recursively in Figure 7.23 Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

11 Figure 7.24 An alternative recursive algorithm for the coin-changing problem Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

12 Figure 7.30 Grid for Exercise 7.31 Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley


Download ppt "Recursion Data Structures & Problem Solving Using JAVA Second Edition Mark Allen Weiss Chapter 7 © 2002 Addison Wesley."

Similar presentations


Ads by Google