Write a method to perform an enhanced sequential research for an integer array. The regular binary search algorithm will return the index of first matching element it encounters. Instead, this method should return the indedx of last matching element in the array. Note: You only need to write down the code inside the myMethod() code block
please make it so i can copy and past
Write a method to perform an enhanced sequential research for an integer array.
The regular binary search
Instead, this method should return the indedx of last matching element in the array.
Note: You only need to write down the code inside the myMethod() code block
public class CST1201Test3
{
public static void main(String[] args)
{
int[] myArray = {
2,5,5,2,6,8,4,6,5,2,3
};
System.out.println(myMethod(myArray));
}
static int myMethod(int[] numbers)
{
// your answer
}
}
Try to write down your logic as comments as clear as possible.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images