Skip to content

Instantly share code, notes, and snippets.

@jasikpark
Created September 3, 2018 15:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasikpark/a1169a6cb8d176a4967090b7129ad7eb to your computer and use it in GitHub Desktop.
Save jasikpark/a1169a6cb8d176a4967090b7129ad7eb to your computer and use it in GitHub Desktop.
Minmax2 code
Algorithm minMax2(A,n)
Input: Array A of n elements
Output: [min,max]
min <- A[0]
max <- A[0]
for i <- 1 to n-1 do
if A[i] < min then
min <- A[i]
else
if A[i] > max then
max <- A[i]
end if
end if
end for
return [min,max]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment