Monday, August 8, 2011

Search through two arrays in nlogn time?

Write an O(nlogn) algorithm that receives as input two n-element arrays a and b of real numbers and a value val. (The arrays are not necessary sorted). The algorithm returns true if there are indexes i and j such that a[i] + b[j] = val and false otherwise.

No comments:

Post a Comment