Question: reate a main method and test your generic binary search in it by completing the next two steps: Create a string array, sort it with
reate a main method and test your generic binary search in it by completing the next two steps:
Create a string array, sort it with Arrays.sort and find an element in the array by calling your g eneric binary search.
Create an integer array and sort it with Arrays.sort. Next define a variable target that is a sum of two variables in your array. Write an algorithm that finds two indices in the array with values that sum to the target. Your algorithm needs to run in Onlogn time and call the generic binary search method you defined.
Note that for testing your code, we will only change target to a different sum of two variables and rerun your code. Your implementation should still be able to find the right indices.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
