Skip to content

Count min sketch #485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 11, 2023
Merged

Count min sketch #485

merged 14 commits into from
Apr 11, 2023

Conversation

aesteve
Copy link
Contributor

@aesteve aesteve commented Apr 5, 2023

Count-Min Sketch

Description

This is a first step towards adding more probabilistic data structures (like Bloom Filters for example).
This PR contains:

  • a new probabilistic module under the data_structures one
  • a CountMinSketch trait containing the contract (basically, increment & return count)
  • the default implementation using multiple hash functions
  • **the introduction of quickcheck as dependency for Property-Based-Testing` which:
    • is really relevant in the case of probabilistic data structures because we can't test exact behavior but rather a property (in that case, a CountMinSketch must not underestimate the count, only overestimate it)
    • would (I think) benefit a lot in other modules like sorting. Since what we want to test in a lot of implementation is the "Oracle" property (for instance in all the sort implementations, we can just generate random inputs and compare with Rust's sort function. This could greatly simplify the tests.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I ran bellow commands using the latest version of rust nightly.
  • I ran cargo clippy --all -- -D warnings just before my last commit and fixed any issue that was found.
  • I ran cargo fmt just before my last commit.
  • I ran cargo test just before my last commit and all tests passed.
  • I checked COUNTRIBUTING.md and my code follows its guidelines.

@aesteve aesteve requested review from siriak and imp2002 as code owners April 5, 2023 10:17
Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, thanks!

Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@siriak siriak merged commit 44fb98b into TheAlgorithms:master Apr 11, 2023
aesteve added a commit to aesteve/algorithms-in-rust that referenced this pull request Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants