Maximum & Minimum problem

Problem: Analyze the algorithm to find the maximum and minimum element from an array.

Algorithm: Max ?Min Element (a [])

Max: a [i]

Min: a [i]

For i= 2 to n do

If a[i]> max then

max = a[i]

if a[i] < min then

min: a[i]

return (max, min)