Question: Write a method, that will take an integer array as input, and a integer i. The method should return the difference between the maximum value

 Write a method, that will take an integer array as input,

Write a method, that will take an integer array as input, and a integer i. The method should return the difference between the maximum value in the array and the i^th largest element. For example, if an array a = {1, 2, 4, 6, 2} and i = 3 is given, the method should return 4, which is 6 - 2 (Note that for i = 4, again the same result should be returned)

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!