News for hackers. Stuff that matters.
Re:How to solve a hard programming interview question by unsatchmo on Wednesday November 29, 2017 @01:26AM (#15805035)
You have to do K comparisons unless you keep track of the ordering of the other K-1 indices every time you pick a new element. Keeping a heap makes this log(K), yielding a KNlog(K) instead of K^2N. The naive solution is probably better when the number of lists to merge is small.

There are no comments on this comment yet.