Skip to content

Generates all possible Dyck words of a given semilength.

Notifications You must be signed in to change notification settings

ethanbarry/dyck-words

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dyck-words

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! :)

Usage

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.

Possible Improvements

  • Check that this actually works as advertised, using tests...?
  • Explore the possibility of using explicit multi-threading with rayon or crossbeams?

About

Generates all possible Dyck words of a given semilength.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages