Question: answer the 3 questions above using the algorithm MaxMin(A:array [1...n] of number) 1 if n is odd then 2 then max=min=A[n] 3 else max= -00;

 answer the 3 questions above using the algorithm MaxMin(A:array [1...n] of

answer the 3 questions above using the algorithm

MaxMin(A:array [1...n] of number) 1 if n is odd then 2 then max=min=A[n] 3 else max= -00; max = 0 4 for i=1 to n/2] 5 if A[2i-1]max then max=large Does the above algorithm correctly find the max and min numbers in the input array? What are its legal inputs? Write an algorithm to find max and min using the strategy of scanning the array left to right, keeping track of the max and min numbers using two local variables. How is the above given algorithm's strategy different from the left to right scanning? Which algorithm is more efficient - the above one or yours

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!