Quiz: Dynamic Programming

Test your knowledge of dynamic programming.

1

What is an obvious reason for the lack of speed of the recurring algorithm of Fibonacci sequence generation (given below)?

RecFibo(n):if n=0return 0else if n=1return 1elsereturn RecFibo(n1)+RecFibo(n2)\underline{RecFibo(n):} \\ \hspace{0.4cm} if\space n = 0 \\ \hspace{1cm} return\space 0 \\ \hspace{0.4cm} else\space if\space n = 1 \\ \hspace{1cm} return\space 1 \\ \hspace{0.4cm} else \\ \hspace{0.4cm} return\space RecFibo(n − 1) + RecFibo(n − 2)

A)

A lot of if statements

B)

Recursive method

C)

The computation of all the Fibonacci numbers again and again by the recursive algorithm

D)

A lot of else statements

Question 1 of 50 attempted

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy