Exam 3: Recursion: the Mirrors

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Suppose sa is a sorted array of integer values,and we wish to search for a number target in this array.If sa contains n elements,and we use the binary search strategy,what is the approximate maximum number of comparisons necessary to determine that the value target is or is not in the array? How would your answer change if the array were not sorted?

(Essay)
4.8/5
(35)

Which of the following is NOT a precondition for an array that is to be sorted by a recursive binary search algorithm? (first is the index of the first item in the array,last is the index of the last item in the array,and SIZE is the maximum size of the array)

(Multiple Choice)
4.8/5
(42)

What is an activation record?

(Essay)
4.8/5
(36)

When constructing a recursive solution,you should assume that a recursive call's postcondition is true if its precondition is true.

(True/False)
4.9/5
(37)

In the box trace,each box roughly corresponds to a(n)______.

(Multiple Choice)
4.7/5
(34)

In the box trace,each box contains all of the following EXCEPT ______.

(Multiple Choice)
4.7/5
(44)

What are the four questions that must be considered when constructing a recursive solution?

(Essay)
4.8/5
(29)

The base case for a recursive definition of the factorial of n is ______.

(Multiple Choice)
4.9/5
(33)

Why do some compilers automatically replace tail recursion with iteration?

(Essay)
4.9/5
(30)

When you solve a problem by solving two or more smaller problems,each of the smaller problems must be ______ the base case than the original problem.

(Multiple Choice)
4.8/5
(37)

The factorial of zero is ______.

(Multiple Choice)
4.8/5
(39)

The base case for a recursive solution to the kth smallest item problem cannot be predicted in advance.

(True/False)
4.8/5
(35)

The binary search algorithm can be applied to an unsorted array.

(True/False)
4.8/5
(40)

When is the base case first > last (where first is the index of the first item in the array and last is the index of the last item in the array)reached in a recursive binary search algorithm?

(Essay)
4.9/5
(41)

An array is a(n)______.

(Multiple Choice)
4.7/5
(37)

Write a recursive method that takes a String parameter and prints out the characters of the string in reverse order.

(Essay)
4.8/5
(39)

Every recursive method must have a base case.

(True/False)
4.9/5
(43)

How many bases cases will be required in a recursive solution that solves a problem by solving two smaller problems of the same type?

(Multiple Choice)
5.0/5
(37)

If the value being searched for by a recursive binary search algorithm is in the array,which of the following is true?

(Multiple Choice)
4.9/5
(43)

A method that is declared as static is an object method.

(True/False)
4.8/5
(37)
Showing 41 - 60 of 60
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)