Algorithm Secret(A[0..n − 1])

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

minval ← A[0]; maxval ← A[0]

for i ← 1 to n − 1 do

if A[i] < minval

minval ← A[i]

if A[i] > maxval

maxval ← A[i]

return maxval − minval

a. What does this algorithm compute?

b. What is its basic operation?

c. How many times is the basic operation executed?

d. What is the efficiency class of this algorithm?

e. Suggest an improvement or a better algorithm altogether and indicate its efficiency class. If you cannot do it, try to prove that, in fact, it cannot be done

### Recently Asked Questions

- You are employed as a supervisor at the local mail distribution centre. The centre wishes to develop a new staff recruitment and selection process, to be

- You find a cube of metal that you think may be aluminum, silver,lead,cobalt or tin. In lab you find that it has a mass of 222 g and a length of 2.7 cm. What is

- Is Prinizide safe in pregnancy? What are the possible complications to the pregnant woman and her fetus?