Rust implementation of the CVM algorithm for counting distinct elements in a stream
0

Configure Feed

Select the types of activity you want to include in your feed.

Docstring

+2 -1
+2 -1
src/lib.rs
··· 4 4 use rand::rngs::ThreadRng; 5 5 use rand::Rng; 6 6 7 + /// A counter implementing the CVM algorithm 7 8 pub struct CVM<T: PartialOrd + PartialEq> { 8 9 buf_size: usize, 9 10 buf: Vec<T>, 10 11 probability: f64, 11 12 rng: ThreadRng, 12 13 } 13 - /// A counter implementing the CVM algorithm 14 + 14 15 impl<T: PartialOrd + PartialEq> CVM<T> { 15 16 /// Initialise the algorithm 16 17 ///