Question: 2. Design a deterministic algorithm to solve the following problem. input : An array A[1..n] of n integers. output : Two indices i and j
2. Design a deterministic algorithm to solve the following problem.
input: An array A[1..n] of n integers.
output: Two indices i and j such that A[j] A[i] = 2018, if such indices exist. Otherwise, return NONE.
Your algorithm must take O(n log(n)) time. You must describe your algorithm in plain English and you must explain why the running time of your algorithm is O(n log(n))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
