Random commentary about C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search

Isn't this the same question as Dec 16th (without the arrays being presorted)?

One rather simple solution could be: O(m*n * log(m*n) [insert each possible sum into max heap] + k [k*O(1) for heap extract-max]) if am not mistaken

Maybe we can solve it by finding median in O(n) and then reduce the lists, and reduce k - depends on a few cases.

Isn't this the same question as Dec 16th (without the arrays being presorted)?

ReplyDeleteOne rather simple solution could be: O(m*n * log(m*n) [insert each possible sum into max heap] + k [k*O(1) for heap extract-max]) if am not mistaken

ReplyDeleteMaybe we can solve it by finding median in O(n) and then reduce the lists, and reduce k - depends on a few cases.

ReplyDelete