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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

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

Post 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 36 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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply