Skip to content

amit2011/Algorithms

 
 

Repository files navigation

Travis License: MIT

Constructive algorithms

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 for testing. To get started install the gradle command-line tool and 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 LinearAlgebra/ folder. You may also create a new category folder if appropriate.
  2. Add the algorithm implementation to Category/ as Category/Foo.java
  3. Add tests for Foo in Category/Foo/tests/FooTest.java
  4. Edit the build.gradle file if you added a new category to the project.
  5. Test your algorithm thoroughly.
  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.

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 FloydWarshallTest.java file under GraphTheory/tests/FloydWarshallTest.java you can execute:

Algorithms$ gradle test --tests "FloydWarshallTest"

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 97.8%
  • JavaScript 2.0%
  • Python 0.2%