Question: Write a recursive algorithm BinSrch to perform binary search on a list of elements that are sorted in non-decreasing order. Modify Algorithm BinSrch so that
Write a recursive algorithm "BinSrch" to perform binary search on a list of elements that are sorted in non-decreasing order. Modify Algorithm "BinSrch" so that it searches for two keys. In other words, given an array A[1..n] of n elements and two elements x1 and x2, the algorithm should return two integer k1 and k2 representing the position of x1 and x2 respectively, in A
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
