Skip to content

vominhtrius/Algorithms

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Travis License: MIT

Dynamic Programming

Geometry

Graph theory

Tree algorithms

Network flow

Other graph theory

Linear algebra

Mathematics

Other

Search algorithms

Sorting algorithms

String algorithms

Contributing

This repository is contribution friendly ๐Ÿ˜ƒ. If you're an algorithms enthusiast (like me!) and want to add or improve an algorithm your contribution is welcome! Please be sure to include tests ๐Ÿ˜˜.

For developers

This project uses Gradle as a build system (and testing). Make sure you have Java 8+ SDK installed and the gradle command-line tool. Run the build command to make sure you don't get any errors:

Algorithms$ gradle build

Adding a new algorithm

The procedure to add a new algorithm named Foo is the following:

  1. Identify the category folder your algorithm belongs to. For example a matrix multiplication snippet would belong to the com/williamfiset/algorithms/linearalgebra folder. You may also create a new category folder if appropriate.
  2. Add the algorithm implementation to com/williamfiset/algorithms/category/ as com/williamfiset/algorithms/category/Foo.java
  3. Add tests for Foo in javatests/com/williamfiset/algorithms/category/FooTest.java
  4. Edit the build.gradle file if you added a new category to the project.
  5. Test your algorithm thoroughly (see testing section below)
  6. Send pull request for review ๐Ÿ˜ฎ

Testing

This repository places a large emphasis on good testing practice to ensure that published algorithms are bug free and high quality. Testing is done using a combinations of frameworks including: JUnit, Mockito and the Google Truth framework. Currently very few algorithms have tests because they were (informally) tested against problems on Kattis in a competitive programming setting, but we are slowly migrating to formally testing these algorithms for robustness. To run all the tests execute:

Algorithms$ gradle test

When developing you likely do not want to run all tests but only a subset of them. For example, if you want to run the FloydWarshallSolverTest.java file under javatests/com/williamfiset/algorithms/graphtheory/FloydWarshallSolverTest.java you can execute:

Algorithms$ gradle test --tests "javatests.com.williamfiset.algorithms.graphtheory.FloydWarshallSolverTest"

License

This repository is released under the MIT license. In short, this means you are free to use this software in any personal, open-source or commercial projects. Attribution is optional but appreciated.

About

A collection of algorithms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 98.5%
  • JavaScript 1.4%
  • Python 0.1%