Question: Question 10[20 points] Consider the algorithm defined by the following pseudo-code: MYALGORITHM (A,n) if n>1 MyAlgoRithm (A,n1) key =A[n] i=n1 while i>0 and A[i]> key
![Question 10[20 points] Consider the algorithm defined by the following pseudo-code:](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f458a582119_50866f458a4ea5e5.jpg)
Question 10[20 points] Consider the algorithm defined by the following pseudo-code: MYALGORITHM (A,n) if n>1 MyAlgoRithm (A,n1) key =A[n] i=n1 while i>0 and A[i]> key A[i+1]=A[i] i=i1 A[i+1]=key Answer the following questions: 1. Describe (with at most a couple of sentences) what problem MYALGORITHM(A,n) will solve, assuming that A is a linear array containing n numbers. 2. If n is the input size of the problem solved by MYALGorithm (A,n), in how many subproblems is the original problem split into? What is the size of a subproblem? 3. Write the recurrence that characterizes the running time T(n) of MYALGORITHM(A,n)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
