Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions