This is a Rust package that computes the Dyck words of a given semilength n by finding the nth Catalan number and applying the algorithm from this paper, which is basically due to Donald Knuth. The algorithm is constant-space and constant-time, as described in the paper above. There's a good chance this is the fastest algorithm possible, though I'm sure my implementation is not! :)
Run:
cargo run --release -- [SEMILENGTH] > output.txt
and then do
less output.txt
to read the results. It prints the Catalan number of your semilength's order at the beginning.
- Check that this actually works as advertised, using tests...?
- Explore the possibility of using explicit multi-threading with
rayon
orcrossbeams
?