9.1. Recursion¶
9.1.1. Objectives¶
Upon completion of this module, students will be able to:
Trace recursive methods
Implement recursive methods
Consider the efficiency of recursive methods
9.1.1.1. Suggested Reading¶
Chapter 7 from Data Structures and Abstractions with Java, 4th edition by Frank M. Carrano and Timothy Henry
9.1.3. Checkpoint 1¶
9.1.4. More Recursion¶
9.1.5. Programming Practice: Recursion 1¶
9.1.6. Recursion on Arrays¶
9.1.6.1. [13:30] Display Arrays Video¶
Correction to note! The code in the second example of this video is
missing {}
in the if block. It should be:
public static void displayArray2(int[] array, int first, int last)
{
if (first <= last) {
displayArray2(array, first, last - 1);
System.out.print(array[last] + " ");
}
}