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

1. Consider the helper method reversePrint, which uses recursion to display in r

ID: 3707735 • Letter: 1

Question

1. Consider the helper method reversePrint, which uses recursion to display in reverse the elements in a section of an array limited by the firstIndex and lastIndexarguments. What statement should be used to complete the recursive method?

2. Which of the following algorithms most naturally involve recursion?

I. Binary Search

II. Insertion Sort

III. Merge Sort

3. What is the best way to describe the complexity of the Insertion Sort algorithm?

4. What is the complexity of the Binary Search algorithm?

5. Which of the following is most true about algorithm complexity, assuming large tasks?

1. array[lastIndex]

Explanation / Answer

1.

Option 2 correct.

System.out.println(array[firstIndex]);

2.

Option 3 correct.

Algorithms most naturally involve recursion

3.

Option 3 correct.

Best way to describe the complexity of the Insertion Sort algorithm Linear.

4.

Option 1 correct.

Complexity of the Binary Search algorithm O(log n)

5.

Option 3 correct.

Exponential-time algorithms are generally practical while polynomial-time algorithms are typiclly not practical

Option 3 correct.

Exponential-time algorithms are generally practical while polynomial-time algorithms are typiclly not practical