Difference between revisions of "TADM2E 2.43"
From Algorithm Wiki
(Recovering wiki) |
(Recovering wiki) |
||
Line 1: | Line 1: | ||
− | Whether we know | + | Whether we know <math>n</math> or not we can sample <math>k</math> values uniformly by assigning a random value to each element, sorting, and taking the top <math>k</math> values. However, this is not very efficient so instead we can use a <i>priority queue</i> of size <math>k</math> with random priority. |
Return to [[Algo-analysis-TADM2E]] ... | Return to [[Algo-analysis-TADM2E]] ... |
Revision as of 18:23, 11 September 2014
Whether we know $ n $ or not we can sample $ k $ values uniformly by assigning a random value to each element, sorting, and taking the top $ k $ values. However, this is not very efficient so instead we can use a priority queue of size $ k $ with random priority.
Return to Algo-analysis-TADM2E ...