Finding median of large set of numbers too big to fit into memory

前端 未结 7 758
梦如初夏
梦如初夏 2020-12-23 02:12

I was asked this question in an interview recently.

There are N numbers, too many to fit into memory. They are split across k database tables (unsorted), each of whi

7条回答
  •  忘掉有多难
    2020-12-23 03:08

    Have a look at the "Median of Medians" algorithm in this wikipedia article.

    Related question: Median-of-medians in Java.

    Explanation: http://www.ics.uci.edu/~eppstein/161/960130.html

提交回复
热议问题