Question: Write a method called range that returns the range of values in an array of integers. The range is defined as 1 more than the

Write a method called range that returns the range of values in an array of integers. The range is defined as 1 more than the difference between the maximum and minimum values in the array. For example, if an array called list contains the values [ 36, 12, 25, 19, 46, 31, 22 ] , the call of range(list) should return 35 (46 - 12 + 1). You may assume that the array has at least one element.

Step by Step Solution

3.51 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public static int range int a int min 0 int max 0 for int i 0 i alength i if i 0 ai ... View full answer

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 Building Java Programs A Back to Basics Approach Questions!