Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Which of the following statements about recursion in not valid: a.A recursive

ID: 3860854 • Letter: 1

Question

1. Which of the following statements about recursion in not valid:

a.A recursive solution has the advantage of using memory move efficiently than other possible solutions.

b. Recursive solutions often lead to more compact solutions (shorter code).

c. Recursion can be used to generate complex graphical figures.

d. Recursion can be used to search file systems for a specific file.

2. Look at the sorted list shown.

Int numberList = {-7, -3, 0, 1, 4, 13, 25, 37, 44, 85};

a. What number would the binary search algorithm examine in a search for the number 5 (list the numbers examined separated by commas)?

b. What would be the outcomeof the search and how would the binary search algorithm indicate this(i.e.how would the method return value indicate the result)?

3. What is the “Big-Oh” time complexity of the following method?

public static void foo(int n, int sum){

int i= n;

while(i>1){

for(int j =0; j<n*n; j++){

    sum++;

}

i=i/2;

    }

}

4.What is the “Big-Oh” time complexity of the following method?

public static void bar(int n){

int z = 0;

for(int i=0; i<n; i++){

System.out.println(i);

for(int j =0; j<n; j++){

System.out.println(z

z++;

         }

    }

}

Explanation / Answer

1. Answer : a : A recursive solution has the advantage of using memory move efficiently than other possible solutions

Above statement is not true for recurssion because with every recursive call all variable are declared again consuming more memory than looping.

Please ask different question separetely as per Chegg Guidelines.