Overview
This public repository contains the Rust source code for the algorithms and clients in the text book Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
Goals
My goal is to cover all the algorithms code that the official algs4 repo provides, implementing them in Rust, trying to keep the APIs compatible to the official Java version.
Features
- In this repo, there is NO code for the exercises and assignments.
- The library code only depends on Rust standard library, no other library is used.
- Unit tests in the
testsmodules. - Clients in
examplesdirectory. - Big-O analysis tools:
DoublingTest,DoublingRatio, Stop Watch (using Rust std), inexamplesdirectory, andLinearRegressionin a library module. - Standard Input
StdInand file inputIn, backed by the Java-util-likeScanner. They are all implemented without any external dependency.
How to
cargo build
cargo test
cargo test -- --show-output # show stdout
cargo test bst # only run the tests which contain name "bst"
Copyright
Copyright © 2025 by Rui Duan.
License
This code is released under GPL version 3 or later.