The Wayback Machine - https://web.archive.org/web/20190322172328/https://github.com/EbTech/rust-algorithms
Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
Common data structures and algorithms in Rust
Branch: master
Clone or download
eric7237cire and EbTech Max bipartite matching (#7)
* Adding a Rust iterator example implementing a DFS iteratively

* Add a bipartite maximum matching test
Refactor dinic to return the actual flow
Latest commit 88b0d6f Jan 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Max bipartite matching (#7) Jan 17, 2019
tests Updated to Rust 2018 edition with improvements to suffix array, count… Sep 24, 2018
.gitignore Create .gitignore Jan 14, 2019
.travis.yml Scanner is no longer recursive. Const-size vectors replaced by Box<[]> Jan 14, 2019
Cargo.toml
LICENSE Update LICENSE Jun 5, 2017
README.md

README.md

Algorithm Cookbook in Rust

Build Status

A collection of classic data structures and algorithms, emphasizing beauty and clarity over full generality. As such, this should be viewed not as a blackbox library, but as a whitebox cookbook demonstrating the design and implementation of algorithms. I hope it will be useful to students and educators, as well as competition programmers.

This repository is distributed under the MIT License. The license text need not be included in contest submissions, though I would appreciate linking back to this repo for others to find. Enjoy!

For Students and Educators

When learning a new algorithm or data structure, it's often helpful to see or play with a concrete implementation. As such, this repository catalogues several classic algorithms in their simplest forms.

In addition, the Rust language has outstanding pedagogical attributes. Its compiler acts as a teacher, enforcing strict discipline while pointing to clearer ways to structure one's logic.

For Programming Contests

The original intent of this project was to build a reference for use in programming contests ranging from Codeforces to Hackerrank. As a result, it contains algorithms that are frequently useful to have in one's toolkit, with an emphasis on making the code concise and easy to modify under time pressure.

Most competition programmers rely on C++ for its fast execution time. However, it's notoriously unsafe, diverting a considerable share of the contestant's time and attention on mistake prevention and debugging. Java is the next most popular choice, offering a little safety at some expense to speed of coding and execution.

To my delight, I found that Rust provides even more bug-safety without the visual clutter, and it's fast. A proficient Rust programmer might stand to gain a competitive advantage as well as a more pleasant experience!

Other online judges that support Rust:

Programming Language Advocacy

My other goal is to appeal to developers who feel limited by mainstream, arguably outdated, programming languages. Perhaps we have a better way.

Rather than try to persuade you with words, this repository aims to show by example. If you're new to Rust, see Jim Blandy's Why Rust? for a brief introduction, or just dive in!

Contents

  • Basic graph representations: adjacency lists, minimum spanning tree, Euler path, disjoint set union
  • Network flows: Dinic's blocking flow, Hopcroft-Karp bipartite matching, min cost max flow
  • Connected components: 2-edge-, 2-vertex- and strongly connected components, bridges, articulation points, topological sort, 2-SAT
  • Associative range query: known colloquially as segtrees
  • Math: Euclid's GCD algorithm, Bezout's identity
  • Scanner: utility for reading input data
  • String processing: Knuth-Morris-Pratt string matching, suffix arrays, Manacher's palindrome search
You can’t perform that action at this time.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.