Question: Consider the following algorithm for finding the maximum, that takes an array A of size 1. def max (A) : n = len (A)
Consider the following algorithm for finding the maximum, that takes an array A of size 1. def max (A) : n = len (A) = A[0] for i in range(1,n) : if A[i]> max : max = A[i] max = return max What comparison is made when i = 3 for the input array [4, 8, 7, 6, 9, 1] (a) Is 9 > 8? (b) Is 7 > 6? (c) Is 8 7? (d) Is 6 > 8?
Step by Step Solution
There are 3 Steps involved in it
The detailed answer for the above question is provided below The comparison ... View full answer
Get step-by-step solutions from verified subject matter experts
