Answers

2014-08-30T15:13:08+05:30

This Is a Certified Answer

×
Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.
FUNCTION MAX_MIN_COMPARE_Count ( A[0, N-1] , N)
Begin
// A[0, N-1] = integer array
integer j          // = index of smallest
integer k         // = index of largest
integer m        //  moving index
integer count   //= of comparisons

m = 0  j = 0  k = 0  count = 0 m = 0

While m < N do
  begin
      count = count + 1
      if A[m] < A[j] then
           j = m
      else
           k = m
      end if
     m = m + 1
  end while

print count
 // A[j] is smallest  and  A[k] is the largest

END

0