(Solved) : 40 Points Binary Linear Search Problem Write Binary Linear Search Functions Return Index S Q44085596 . . .
(40 points) Binary & Linear Search In this problem, you willwrite binary and linear search. For both functions
you are to return the index of the specified number, or -1 ifthe
number is not in the input list. Also, even if you pass thetests, the TAs
will go through the code and ensure you implemented linearsearch
for linear search and binary search for binary search.
For example, searching [0, 5, 10] for 10 should return 2.Searching [0, 5, 10] for 12 should return -1.
(a) In repl.it implement the linearSearch() method. This methodshould
perform linear search on the given input list, and return anindex, or -1 if
the element doesn’t exist. (b) In repl.it implement thebinarySearch() method. This method should
perform binary search on the given input list, and return anindex, or -1
if the element doesn’t exist.
inputArray – a passed in array of integers, not necessarilysorted
sortedArray – a sorted array of integers
searchTarget – the number you are searching for
Helpful hints:
You are looking to return the index of the found number.
Needs :
Code in java
Expert Answer
Answer to (40 points) Binary & Linear Search In this problem, you will write binary and linear search. For both functions you are …
OR