Exercise 3.2: Vector Max and Min

Given: two vectors, x and y, of equal size and range;
Compose: a loop that returns two vectors, containing the larger and smaller elements, respectively, of each position in the two vectors.
for i in 1, size
   minimum,
   maximum := if x[i] < y[i] then
                 x[i], y[i]
              else
                  y[i], x[i]
              end if
returns array of maximum
        array of minimum
end for


Previous Section