Question: Given this algorithm, do the following - 1) describe the best case input (i.e., the nature of the input). (1.5pts) 2) describe the worst case
Given this algorithm, do the following -
1) describe the best case input (i.e., the nature of the input). (1.5pts)
2) describe the worst case input (i.e., the nature of the input). (1.5pts)
3) give a detailed analysis (i.e., a line by line analysis) as we did in class for linearSearch for the best case. Represent the runtime in big-O notation. (3.5pts)
4) give a detailed analysis (i.e., a line by line analysis) as we did in class for linearSearch for the worst case. Represent the runtime in big-O notation. (3.5pts)

Input: an array A of size n Output: min and max elements in A FindMinMax (A, n, min, max) 1. max = A[1] 2. min = A[1] 3. for i = 2 ton 4. if A[i] > max 5. max = A[i] 6. else if A[i]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
