<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>蓄水池抽样 on 111qqz's blog</title><link>https://111qqz.com/en/tags/%E8%93%84%E6%B0%B4%E6%B1%A0%E6%8A%BD%E6%A0%B7/</link><description>Recent content in 蓄水池抽样 on 111qqz's blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>© 2015-2026 111qqz</copyright><lastBuildDate>Thu, 09 Mar 2017 12:14:11 +0000</lastBuildDate><atom:link href="https://111qqz.com/en/tags/%E8%93%84%E6%B0%B4%E6%B1%A0%E6%8A%BD%E6%A0%B7/index.xml" rel="self" type="application/rss+xml"/><item><title>蓄水池抽样算法概述(Reservoir Sampling Algorithm)[转载]</title><link>https://111qqz.com/en/post/acm-icpc/2017/2017-03-09-e89384e6b0b4e6b1a0e68abde6a0b7e7ae97e6b395e6a682e8bfb0reservoir-sampling-algorithme8bdace8bdbd/</link><pubDate>Thu, 09 Mar 2017 12:14:11 +0000</pubDate><guid>https://111qqz.com/en/post/acm-icpc/2017/2017-03-09-e89384e6b0b4e6b1a0e68abde6a0b7e7ae97e6b395e6a682e8bfb0reservoir-sampling-algorithme8bdace8bdbd/</guid><description>&lt;p&gt;面京东被这个问题卡了QAQ，来补补这方面的课。&lt;/p&gt;
&lt;p&gt;转自：&lt;a href="http://www.cnblogs.com/python27/p/Reservoir_Sampling_Algorithm.html" target="_blank" rel="noreferrer"&gt;链接&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;蓄水池抽样算法随机算法的一种，用来从 N 个样本中随机选择 K 个样本，其中 N 非常大（以至于 N 个样本不能同时放入内存）或者 N 是一个未知数。其时间复杂度为 O(N),包含下列步骤 (假设有一维数组 S, 长度未知，需要从中随机选择 k 个元素, 数组下标从 1 开始), 伪代码如下:&lt;/p&gt;</description></item></channel></rss>