Question: 2. The following algorithm is to find the maximum value in an array A of size n. e. What are the primitive operations of
2. The following algorithm is to find the maximum value in an array A of size n. e. What are the primitive operations of the algorithm? f. Calculate T(n); the number of times the primitive operations are executed by the algorithm in the worst case scenario. g. What is the big O (the complexity) of the algorithm? Algorithm findmax (A, n) Input array A of n integers Output the maximum value in A max = A [0] for (i = 1 to n-1) do if (max < A[i]) max f A[i] return max
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
