Question: Provide a method named minDifference accepts an one dimensional int array as parameter. This method find and return the minimum difference between two consecutive

Provide a method named minDifference accepts an one dimensional int array as

parameter. This method find and return the minimum difference between two consecutive

Provide a method named minDifference accepts an one dimensional int array as parameter. This method find and return the minimum difference between two consecutive elements in an array. (Hint: initialize the min difference as the difference of the first two elements, use a for loop, update min difference wheneven find a smaller difference between two consecutive elements) Question 25 (4 points) Provide a method named reverse which accepts an one dimensional int array as parameter. It will reverse the array. For example, if array contains (1, 2, 3, 4, 5), after the reverse(array), array content will be changed to (5, 4, 3, 2, 1). (Hint: this can be done to use a for loop to switch the first element with the last element, the second element with the second to the last element and so on. Find the pattern of the index change is the key).

Step by Step Solution

3.37 Rating (147 Votes )

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!