Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Absolute C++
Quiz 13: Recursion
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Practice Exam
Learn
Question 21
Essay
Give the three criteria for a correct value being returned by a recursive function.
Question 22
Essay
Give a general outline of a successful recursive function definition.
Question 23
Essay
Write a recursive function double recSum(double array[],int count); that takes an int argument and returns the sum of count array entries.
Question 24
Essay
Iterative solutions are always possible.Why then,would we bother with recursive solutions to problems? What advantages do some recursive algorithms have over the iterative versions?
Question 25
Essay
In the binary search,each pass (recursion or iteration)selects a subproblem of the original problem to solve.What fraction of the array sent to an initial call is eliminated in the next iterative pass or recursive call?
Question 26
Essay
In the binary search,if the array being searched has 32 elements in it,how many elements of the array must be examined to be certain that the array does not contain the key? What about 1024 elements? Note: the answer is the same regardless of whether the algorithm is recursive or iterative.
Question 27
Essay
Here is a recursive function.Write an iterative version of it.Hint: Be sure you get the number of copies of "Hip" right. void rec_cheers(int n) { using namespace std; if(1==n) cout << "Hurray!" << endl; else { cout << "Hip,"; rec_cheers(n-1); } }