• Stars
    star
    177
  • Rank 215,985 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Algorithms and data structures implemented in Go, JS, TypeScript, Rust, and Swift.

algo Build Status

This is just me fooling around and implementing various algorithms and data structures in Go, JavaScript, TypeScript, Rust, and Swift.

Many of these problems appear in Steven Skiena's Algorithm Design Manual, which I heartily recommend.

Modules do not share code and use built-in language features only. This makes each module easiest to understand individually.

Disclaimers

  • These modules are optimized for readability instead of performance, and often do not achieve the best time or space complexities.
  • These modules are not very well-tested, and definitely not intended for production use. If you do it anyway, please share your post-mortem :)
  • I don't have much experience with Rust, so there might be simpler and cleaner ways to do things.
  • Some older TS modules do not use features introduced in TS 1.6+.
  • Generics are avoided in favor of concrete types for readability.

Test a Go module

Install Go. Then run:

$ ./test_go mergesort

(Replace mergesort with the name of the module of your choice.)

Test a JavaScript module

Install Node.js and run npm install. Then run:

$ ./test_javascript mergesort

Test a TypeScript module

Install Node.js and run npm install. Then run:

$ ./test_typescript biconnected_components

Test a Rust module

Install Rust. Then run:

$ ./test_rust edge_connectivity

Test a Swift module

Install Swift. Then run:

$ ./test_swift rotating_calipers

Test all modules and languages

Install all the language-specific requirements above. Then run:

$ ./test

Test a module automatically after each source code change

Install all the language-specific requirements above and install rerun. Then run:

$ ./watch mergesort

Contribute

Pull requests are welcome. Improvements to existing modules will be merged as soon as possible. Completely new modules will take longerβ€”this repo is a learning exercise, so I'll try to solve the problem on my own before merging.