Question: 2. Let A [A[i] B[2]>... > Bnl] be an array of n distinct integers (could be negative or positive) sorted in a decreasing order. Describe
2. Let A [A[i] B[2]>... > Bnl] be an array of n distinct integers (could be negative or positive) sorted in a decreasing order. Describe an efficient algorithm to determine whether there exists an index i such that Ali] B. What is the worst-case number of comparisons made by your algorithm? Try to be exact. Otherwise, you may use the O-notation. Justify the correctness and complexity of your algorithm
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
