GitHunt
SN

SnowballSH/safe_dsa

Safe, provably correct, generic implementations of various DSA in Rust with contracts.

Safe DSA

This repository aims to collect safe, correct, and generic implementations
of various algorithms and data structures as I learn more about them.

What is special about this repository?

All algorithms and data structures are implemented with the following
principles in mind:

  • Good enough documentation
  • Good preconditions and postconditions
  • Good loop invariants and struct invariants
  • Genericity whenever possible
  • Provable correctness and safety
  • Avoid overflows (such as common binary search mistakes)

What do I hope to learn from this project?

  • Be more familiar with advanced Rust features like
    macros and generics
  • Review algorithms I already know
  • Try to implement algorithms I learn in math and CS lectures
  • Learn new algorithms I do not yet know
  • Avoid using AI code completion or code generation

Sources

https://oi-wiki.org

https://www.cs.cmu.edu/~15122/

https://crates.io/crates/contracts

Contributors

Created October 24, 2025
Updated October 27, 2025
SnowballSH/safe_dsa | GitHunt