阅读背景:

Reservoir Sampling - 蓄水池抽样问题

来源:互联网 

问题起源于编程珠玑Column 12中的题目10,其描述如下:

  How could you select one of n objects at random, where you see the objects sequentially but you do not know the value of n beforehand? For concreteness, how would you read a text file, and select and print one random line, when you don’t know the number of lines in advance?  How could y




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: