Question: COURSE: algorithm and data structure please need solution on comment no paper 1) int x(int n) { int m = 0; n = n +

 COURSE: algorithm and data structure please need solution on comment no COURSE: algorithm and data structure

please need solution on comment no paper

1) int x(int n) { int m = 0; n = n + m + 1; return n; } int y(int n) { int m = 1; n = x(n); return m + n; } What does y(3) return? 2) void test(int n) { if (n>0){ System.out.println(n); test(n-1); System.out.println(n); } } i)Trace the execution of test(4) ii) Trace the execution of test (-4) 3) Write a recursive function that prints the numbers 1...n in descending order. 4) Write a recursive function to perform exponentiation return xm, assuming m >= 0: public int exp(int x, int m) {

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!