Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(4 marks) Consider the following recursive algorithm Fct(n) which can take any integer n0 as input. begin{tabular}{l} hline Algorithm 1Fct(n) hline 1: if n3
(4 marks) Consider the following recursive algorithm Fct(n) which can take any integer n0 as input. \begin{tabular}{l} \hline Algorithm 1Fct(n) \\ \hline 1: if n3 then \\ 2: return 1 \\ 3: else \\ 4: return Fct(n2)+2Fct(n3)+2n \\ 5: end if \end{tabular} Let W(n) be the number of multiplications () done in a call to Fct(n). Which of the following expressions describes W(n) ? Let W(n) be the number of multiplications () done in a call to Fct(n). Which of the following expressions describes W(n) ? W(n)=1 for n3, and W(n)=W(n2)+2W(n3) for n>3 All other answers are wrong. W(n)=0 for n3, and W(n)=W(n2)+W(n3)+2 for n>3 W(n)=0 for n3, and W(n)=W(n2)+W(n3) for n>3 W(n)=1 for n3, and W(n)=W(n2)+2W(n3)+2n for n>3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started