Question: 1. Below are the pseudo codes of 3 algorithms. Alg1 (n): if n = 0 else end Alg2 (n): else if n = 0
1. Below are the pseudo codes of 3 algorithms. Alg1 (n): if n = 0 else end Alg2 (n): else if n = 0 end Alg3 (n): if n = 0 else return / end return 2*Alg1(n-1) return / return Alg2(n-1) + Alg2(n-1) return / m=[n/2] p= Alg3(m) if n is odd else end return 2*p return p a) What does each algorithm compute? b) Compute the running time of ach algorithm.
Step by Step Solution
There are 3 Steps involved in it
a What each algorithm computes Alg1n This algorithm computes the result of multiplying 2 by the outp... View full answer
Get step-by-step solutions from verified subject matter experts
