Question: please use java to code this please and can you add comments explaining each step thank you! Background: Applying linear search and binary search on
please use java to code this please and can you add comments explaining each step thank you!


Background: Applying linear search and binary search on arrays. Step 1: Search class Implement a Search class that will contain methods for linear search and binary search. Implement 2 linear search methods (one for integers and one for Strings). Also, implement 2 binary search methods (one for integers and one for Strings). The methods will take 2 parameters: an array and a search item, and will return the location of the item in the array if found, or -1 if not found. Search class Methods: public static int linear Search( int[] values, int searchvalue ) public static int linear Search( String[] words, String searchword ) public static int binarySearch( int[] values, int searchvalue) public static int binarySearch( String[] words, String searchword ) Sample code for linear search and binary search (integer versions) is given below. Both examples work on a sample array of integers called values, and an integer parameter variable called searchvalue. Linear Search for(int i=0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
