I am working on a homework problem and am having difficulty creating an O (n * logn) solution. I need to write a function that takes a pre-sorted array and a search value. Then I need to find if any two elements of the array are summed in the same way as this value.
I need to create both O (n) and O (n * logn) algorithms for this.
O (n) was easy to create; however, I am having difficulty creating the O (n * logn) algorithm without adding some free code that actually does not help in solving the problem. If anyone could give me some pointers to what I can skip, this would be appreciated.
source
share