Question: 2. Print Array Using Recursion (1). 1 public class Ch16Exo 2 { 3 4 5 6 7 8 9 10 11 12 13 private static

 2. Print Array Using Recursion (1). 1 public class Ch16Exo 2{ 3 4 5 6 7 8 9 10 11 12 13

2. Print Array Using Recursion (1). 1 public class Ch16Exo 2 { 3 4 5 6 7 8 9 10 11 12 13 private static int[] array = {1,2,3,4,5,6,7}; public static void main(String [] args) { /* Iterative way for(int e: array) System.out.println(e); */ 14 // Recursive printRecursion(array.length); } 15 16 1.7 18 19 20 } public static void printRecursion(int i) { } Figure 1: Print array using recursion Please finish the printRecursion() method. The output should be 1,2,3,4,5,6,7. (You should use recursion to solve this problem. You can use other programming language) 1 public class Ch16Exo 2 { 3 4 private static int[] array = {1,2,3,4,5,6,7}; 5 6 public static void main(String [] args) 7 { 8 /* Iterative way 9 for(int e: array) 10 System.out.println(e); 11 */ 12 13 // Recursive 14 printRecursion(array.length); 15 } 16 17 public static void printRecursion(int i) { 1.8 } 19 20 } Figure 2: Print array backwards using recursion 3. Print Array Using Recursion (2). Please finish the printRecursion() method. The output should be 7,6,5,4,3,2,1. (You should use recursion to solve this problem. You can use other programming language)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!