Thanks to visit codestin.com
Credit goes to github.com

Skip to content

romac/cmv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmv

Crates.io Version Crates.io License Crates.io MSRV

Rust implementation of Distinct Elements in Streams: An Algorithm for the (Text) Book by S. Chakraborty, K. Meel, N. V. Vinodchandran.

Usage

use rand::SeedableRng;
use rand::rngs::SmallRng;

use cmv::Cmv;

fn estimate_distinct(words: &[&str]) -> u128 {
      let mut rng = SmallRng::seed_from_u64(0x123456789);
      let mut cmv = Cmv::with_capacity(128);

      for &word in words.iter() {
          cmv.insert(word, &mut rng);
      }

      cmv.count()
}

License

Licensed under the Apache 2.0 license.

About

Rust implementation of "Distinct Elements in Streams: An Algorithm for the (Text) Book"

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages