Question: 3. Let A Al A B[2] > .. . > Bln] be an array of n distinct positive integers sorted in a decreasing order. order.
3. Let A Al A B[2] > .. . > Bln] be an array of n distinct positive integers sorted in a decreasing order. order. Let k be a positive integer. Describe an efficient algorithm to determine whether there exist two indices 1 i, j n such that A[i] + BLi-k. What is the worst-case number of additions 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
