Question: Consider the following recursive function: int recFunc ( int num ) { if ( num = = 0 ) return 0 ; else if (

Consider the following recursive function: int recFunc (int num){ if (num ==0) return 0; else if(num <0) return (-num); else return (num - recFunc(num -5)); }
a. Identify the base case.
Answer: Lines __________
b. Identify the general case.
Answer: Lines __________
c. If recFunc(35) is a valid call, what is its value? If not, explain why.
Answer: __________
d. If recFunc(-26) is a valid call, what is its value? If not, explain why.
Answer: __________
e. If recFunc(15) is a valid call, what is its value? If not, explain why.
Answer: __________

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!