Question: 2 a) Write the algorithm for finding the position of smallest elements in an array. Find its Time complexity using substitution method. b) Write the
2 a) Write the algorithm for finding the position of smallest elements in an array. Find its Time complexity using substitution method. b) Write the steps for analyzing the efficiency of Non Recursive algorithm. The following is a recursive algorithm for finding the factorial of n number. ALGORITHM F(n) //Computes n! recursively //Input: A nonnegative integer n //Output: The value of n! if n = 0 return 1 else return F(n- 1) * n i) What is the basic operation of the algorithm? ii) Setup a recurrence relation for the following Algorithm. iii) Solve the recurrence relation and find the efficiency of the algorithm.
2 a) Write the algorithm for finding the position of smallest elements in an array. Find its Time complexity using substitution method. b) Write the steps for analyzing the efficiency of Non Recursive algorithm. The following is a recursive algorithm for finding the factorial of n number. ALGORITHM F(n) //Computes n! recursively //Input: A nonnegative integer n //Output: The value of n! if n=0 return 1 else return F(n-1) *n 1) What is the basic operation of the algorithm? ii) Setup a recurrence relation for the following Algorithm. iii) Solve the recurrence relation and find the efficiency of the algorithm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
