Question: Create a sorted list of 1 0 integers, then create a binary search algorithm that searches through that sorted list. Print out the target element
Create a sorted list of integers, then create a binary search algorithm that searches through that sorted "list". Print out the target element and the number of elements checked before the target element was found. If the element was not found in the list, print an appropriate message.
Hint: to keep track of the number of elements checked before the targe element is found, create a global variable and increment it each time an element is checked and print it in the main method.
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
