Question: 1 . Write in pseudo code a binary search algorithm that works over an array. Use the iterative method. Comment to explain the algorithm. 2
Write in pseudo code a binary search algorithm that works over an array. Use the iterative method. Comment to explain the algorithm.
Write in the programming language of your choice a binary search algorithm that works over an array. Comment to explain the algorithm.
Use the attached file numbers.txt Download numbers.txtand use your algorithm to answer the below questions. You will have to implement an operation counter to answer these. Submit your code that answers these.
a What is the position of in the array? How many operations did it take to find?
b What is the position of in the array? How many operations did it take to find?
c What is the position of in the array? How many operations did it take to find?
d What is the worst case time complexity? Evaluate line by line, create a time complexity function and then define its Big O value.
e What would the worst case time complexity be if we have entries instead of
f What do you think the average case time complexity is for binary search? Explain your reasoning.
Evaluate the time complexity of the following code snippets. Evaluate line by line, create a time complexity function and then define its Big O value.
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
