Question: Algorithm Lab Week 3 : Binary Search Description Binary search in a well - known divide and conquer algorithm. In original, binary search is designed

Algorithm Lab
Week 3: Binary Search
Description
Binary search in a well-known divide and conquer algorithm. In original, binary search is designed for searching position of specific value in a sorted random-accessible list.
We can see an array A={a1,a2,dots,an} as a function A'(i)=ai have domain 1,n. If array A is an increasing-order array or a decreasing-order array, then the correspond function A'(i) is a monotone function. Thus, we can change the definition as followed:
Instance: A monotone function f(x)V, a value vinV, and a precision .
Result: xinx that v in range f(x-),f(x+).
In this version, we can not only find the specific value in a sorted array (use =1), but also solve an equation y=f(x) where y is the specific value and f(x) is a monotone function.
Questions
1 Write pseudo code of binary search algorithm.
2 Analysis pseudo code of step 1.
2.1 Space complexity
2.2 Time complexity in base case
2.3 Time complexity in worst case
 Algorithm Lab Week 3: Binary Search Description Binary search in a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!