Question: Consider the following algorithm exp ( a , n ) that computes an . Let Cn be the number of ( a , n )
Consider the following algorithm expan that computes an Let Cn be the number of
a n mulitplication performed by exp
expan
if n
returna;
m n; integer division
power expam;
power power power
if n is even
return power ;
else
returnpower a;
a Prove that expan is correct. That is show that expan returns an
b Give a recurrence equation for CnHint: consider cases: n is even and n is
odd.
Solve the recurrence equation in case n is a power of c
d Give an example where Ci Cj and i j
e Show that Cn Elogn
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
