if n = 0 or n = 1 or n = 2 f(n) = {f(n – 2) + f(n – 4) %3D %3D otherwise

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 8SA
icon
Related questions
Question
Given the recursive function below where n is an integer:
if n = 0 or n = 1 or n = 2
f(n) = {f(n – 2) + f(n – 4)
otherwise
Which of the following statements is true?
IMPORTANT: There is no "Check" button for this question. You can change the answer as many times as you like.
Select one:
O a. The function terminates if and only if n is 1 or even.
O b. The function terminates if and only if n24.
O . The function terminates if and only if n=1 or n is even and greater or equal to 0.
O d. The function terminates if and only if n is 0, 1 or 2.
O e. The function terminates if and only if n20.
Transcribed Image Text:Given the recursive function below where n is an integer: if n = 0 or n = 1 or n = 2 f(n) = {f(n – 2) + f(n – 4) otherwise Which of the following statements is true? IMPORTANT: There is no "Check" button for this question. You can change the answer as many times as you like. Select one: O a. The function terminates if and only if n is 1 or even. O b. The function terminates if and only if n24. O . The function terminates if and only if n=1 or n is even and greater or equal to 0. O d. The function terminates if and only if n is 0, 1 or 2. O e. The function terminates if and only if n20.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning