Question: ( a ) Describe your algorithm clearly in English. ( b ) Give pseudocode. ( c ) Argue correctness, even if you don t give

(a) Describe your algorithm clearly in English.
(b) Give pseudocode.
(c) Argue correctness, even if you dont give a formal proof and give a convincing
argument instead.
(d) Give with explanation the best upper bound that you can for the running time
ii)(8 points) Give a non-recursive algorithm that asymptotically performs fewer addi-
tions than the recursive algorithm. Discuss the running time of the new algorithm.
iii)(15 points) Give an algorithm to compute Fn in O(logn) time using only integer
additions and multiplications.
Hint: Observe that
[F2F1]=[1110]*[F1F0].
Can you use this observation to compute Fn?
iv)(15 points) The Fibonacci Plus numbers are defined below (n,a and b are all inte-
gers).
Pn={a,ifn=0b,ifn=1Pn-1+2Pn-2+3n,ifn2
Give an algorithm to compute Pn in O(logn) time.
Hint: Similarly to part iii), find a suitable matrix to apply to the initial vector
[P1P021]T so that P2 is an entry of the resulting vector. (Other choices of
initial vector-and accordingly, matrix-may work too.) Then show how to compute
Pn.
(b)(21 points) Now assume that adding two m-bit integers requires (m) time and that
multiplying two m-bit integers requires (m2) time. Analyze the running time of the first
three algorithms in part (a) under this more reasonable cost measure for the elementary
arithmetic operations.
 (a) Describe your algorithm clearly in English. (b) Give pseudocode. (c)

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!