Question: Provide a method named reverse which accepts an one dimensional int array as parameter. It will reverse the array. For example, if array contains
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.40 Rating (147 Votes )
There are 3 Steps involved in it
Certainly Heres a Java method named reverse that accepts a one... View full answer
Get step-by-step solutions from verified subject matter experts
