Question: ( 2 0 points ) Assume $n$ is a power of $ 6 $ . Assume we are given an algorithm $f ( n )

(20 points) Assume $n$ is a power of $6$. Assume we are given an algorithm $f(n)$ as follows:
\begin{Verbatim}
function f(n):
if n>1:
for i in range(34):
f(n/6)
for i in range(n*n):
print("Banana")
f(n/6)
else:
print("Monkey")
\end{Verbatim}
\begin{enumerate}[label=(\alph*.)]
\item What is the running time for this function $f(n)$? Justify your answer. (Hint: Recurrences)
\begin{solution}
[Write your answer here]\vspace{12pt}% delete this line and replace with your answer/work
\end{solution}
\item How many times will this function print ``Monkey"? Please provide the exact number in terms of the input $n$. Justify your 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 Databases Questions!