Question: Consider an unsorted array A where M is the maximum element and m is the minimum element. Let n be the number of elements in

Consider an unsorted array A where M is the maximum element and m is
the minimum element. Let n be the number of elements in the array.
1. Show that there exist two elements A[i] and A[j] in the array A such that i = j
and |A[i] A[j]|<=(M m)/(n 1).
2. Provide an algorithm to find such indices i and j.
1

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 Programming Questions!