Algorithm secret


. Consider the following algorithm. 

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 

Answer questions (a)-(e) of Problem 3 about this algorithm. 
4. Consider the following algorithm. 

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 

Answer questions (a)-(e) of Problem 3 about this algorithm.  

Request for Solution File

Ask an Expert for Answer!!
Data Structure & Algorithms: Algorithm secret
Reference No:- TGS082350

Expected delivery within 24 Hours