Hacker News new | ask | show | jobs
by szemet 3165 days ago
If the data structures can be split (as it seems), then the first step should be to get the head k element of both collections, so we only have to work with a maximum of 2k elements. Then the solution is not O(2 * log(N)) but O(2 * log(min(N,2k))).
2 comments

Good thought, and also if k < N / 2
Edited the post and added your comment