You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A comprehensive collection of data structures and algorithms implemented in C, Go, Java, Python, Rust, and TypeScript.
Every language has:
Unit tests for each data structure and algorithm
Seeded randomized tests that compare implementations against simple reference models
Time & space complexity notes
Most C, Python, and Rust sources also include ASCII diagrams and LeetCode problem
mappings in their header comments. The Go, Java, and TypeScript sources use shorter
doc comments.
GCD/LCM, primality and sieve, prime factors, fast power, Euler's totient, modular inverse, binomial and Catalan numbers, bit tricks
Quick Start
C
cd by-language/c
make test
Go
cd by-language/go
go test ./...
Java
cd by-language/java
./gradlew test
Python
cd by-language/python
pip install pytest
pytest tests/
Rust
cd by-language/rust
cargo test
TypeScript
cd by-language/typescript
bun install
bun run typecheck
bun test
Correctness and API contracts
The remediation notes record the boundary cases covered by
the regression suites and the commands used to verify them. C
shortest_path_reconstruct and graph_floyd_warshall_path take the output
array capacity; Rust reconstruct_path takes the source vertex. Callers of
those APIs should update their arguments before using the revised
implementations. C graph weights reserve GRAPH_INF (INT_MAX), and graph
algorithms reject unrepresentable path distances or MST totals.
Git Hooks (Optional)
# Install pre-commit, pre-push, and commit-msg hooks
./.githooks/install.sh
The pre-commit hook checks Rust formatting and Clippy, Go formatting, and Python
lint when ruff or black is installed. The pre-push hook runs the suite for
each language whose toolchain is installed.
Implementation Template
The C, Python, and Rust header comments follow this format: