Question: Create a java class Inside class, write a method with the following method signature: int checkNumbers(int[] numbers, int low, int high) input is the array
Create a java class
Inside class, write a method with the following method signature:
int checkNumbers(int[] numbers, int low, int high)
input is the array of the numbers
array is not sorted, and all the numbers are positive.
method return the number if more than half of students agree on. If not the he method should return -1.
low and high are two indices that identify the range of the numbers that are to be checked.
//////required////// you need to use a divide and conquer algorithm, and the time complexity should be O(nlogn)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
