This is the third time I post this question since no one is giving me the approp
ID: 3790903 • Letter: T
Question
This is the third time I post this question since no one is giving me the appropriate answer. THIS IS NOT A CODING QUESTION so please do not provide me any codes because I will not understand. This is a discrete math question (Recursion topic) so please provide full explanations/steps/calculations. Thanks.
Question 6: Elisa Kazan' loves to drink cider. During the weekend, Elisa goes to the pub and runs the following recursive algorithm, which takes as input an integer n? 0: Algorithm ELISAGoESTOTHEPUB(n): if n then order Fibonachos else if n is even then ELISAGoESTIOTHEPUB(n/2); drink n2/2 pints of cider; ELISAGoESTOTHEPUB(n/2) else for 1 to 4 do ELISA GoESTO 1)/2) drink (n 1)/2 bottles of cider endfor: drink 1 bottle of cider endif endif For n 20, let C(n) be the number of bottles of cider that Elisa drinks when running algorithm ELISAGoESTOTHEPUB(n). Determine the value of C(n).Explanation / Answer
To solve this question you need to understand how the recursion works.
Suppose n=4.
Then when the function gets called :
To insert the values in the algorithm you do not need to understand coding. Just understand the recursive algorithm. I hope the algorithm is clear to you and how the function call goes inside the recursive function.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.