An array a contains n integers in non-decreasing order, A[1] ≤ A[2] ≤ ... ≤…

PYQ GATE 1994

An array a contains n integers in non-decreasing order, A[1] ≤ A[2] ≤ ... ≤ A[n].

Describe, using Pascal like pseudo code, a linear time algorithm to find i, j, such that A[i] + A[j] = a given integer M, if such i, j exist.

Attempted by 1 students.

Sign up free to check your answer

Sign up free

Explore the full course: Algorithms

Loading lesson…