Exam 3: Recursion: the Mirrors
Exam 1: Review of Java Fundamentals60 Questions
Exam 2: Principles of Programming and Software Engineering60 Questions
Exam 3: Recursion: the Mirrors60 Questions
Exam 4: Data Abstraction: The Walls60 Questions
Exam 5: Linked Lists60 Questions
Exam 6: Problem Solving With Abstract Data Types60 Questions
Exam 7: Stacks60 Questions
Exam 8: Queues60 Questions
Exam 9: Advanced Java Topics60 Questions
Exam 10: Algorithm Efficiency and Sorting60 Questions
Exam 11: Trees60 Questions
Exam 12: Tables and Priority Queues60 Questions
Exam 13: Advanced Implementations of Tables60 Questions
Exam 14: Graphs60 Questions
Exam 15: External Methods30 Questions
Select questions type
What are the two base cases for a recursive binary search algorithm?
Free
(Essay)
4.7/5
(37)
Correct Answer:
The two base cases are:
-first > last
-value == anArray[mid]
(where first is the index of the first item in the array,last is the index of the last item in the array,and mid is the midpoint of the array).
The number of ways to choose k out of n things is ______.
Free
(Multiple Choice)
4.9/5
(27)
Correct Answer:
C
The midpoint of a sorted array can be found by ______,where first is the index of the first item in the array and last is the index of the last item in the array.
(Multiple Choice)
4.8/5
(34)
What is the base case for the recursive solution to the Towers of Hanoi problem?
(Essay)
4.9/5
(33)
When is the base case value == anArray[mid] (where mid is the midpoint of the array)reached in a recursive binary search algorithm?
(Essay)
4.8/5
(30)
Which of the following is a precondition for a method that accepts a number n and computes the nth Fibonacci number?
(Multiple Choice)
4.9/5
(36)
A recursive binary search algorithm always reduces the problem size by ______ at each recursive call.
(Multiple Choice)
4.9/5
(37)
Which of the following is a base case for 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 mid is the midpoint of the array).
(Multiple Choice)
4.9/5
(37)
Suppose a program contains a recursive method findFibonacci(int n),which computes the n-th Fibonacci number.Even if we know that a client method will never call findFibonacci( )with the values 1 or 2 as arguments,why does the implementation of findFibonacci( )still need to have base cases?
(Essay)
4.8/5
(48)
In a recursive solution,the ______ terminates the recursive processing.
(Multiple Choice)
4.9/5
(35)
Why does the Fibonacci sequence have two base cases? In other words,would it be possible to write a correct recursive Fibonacci method that has only one base case?
(Essay)
4.7/5
(33)
A recursive method that computes the number of groups of k out of n things has the precondition that ______.
(Multiple Choice)
4.9/5
(42)
In the recursive solution to the kth smallest item problem,the problem size decreases by ______ at each recursive call.
(Multiple Choice)
4.8/5
(31)
In the Fibonacci sequence,which of the following integers comes after the sequence 1,1,2,3?
(Multiple Choice)
4.9/5
(33)
What are the two factors which contribute to the inefficiency of some recursive solutions?
(Essay)
4.7/5
(37)
Showing 1 - 20 of 60
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)