Page 1 of 1

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

Posted: Mon Jun 06, 2022 1:22 pm
by answerhappygod
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 1
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 1 (39.28 KiB) Viewed 38 times
Consider the above algorithm.
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.
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 < minval minval ← A if A> maxval maxval ← A return maxval - minval