Question: Question 1: For the algorithm on the right: 1. What is its basic operation? 2. What is the efficiency class of this algorithm? Solve a

Question 1: For the algorithm on the right:

1. What is its basic operation?

2. What is the efficiency class of this algorithm? Solve a summation to support your answer.

3. Are the best, average, and worst case time efficiencies the same? Justify your reasoning.

Algorithm 1: Range(A[0...n 1])

1: Input: An array A[0...n 1] of n real numbers

2: minval = A[0];

3: maxval = A[0];

4: for i = 1 to n 1 do

5: if A[i] < minval then

6: minval = A[i];

7: if A[i] > maxval then

8: maxval = A[i];

9: end

10: return maxval - minval;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!