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, 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
Get step-by-step solutions from verified subject matter experts
