Coder Social home page Coder Social logo

williamfiset / algorithms Goto Github PK

View Code? Open in Web Editor NEW
17.9K 426.0 4.5K 1.22 GB

A collection of algorithms and data structures

License: MIT License

Java 99.12% Python 0.05% JavaScript 0.64% Kotlin 0.18%
algorithms linear-algebra graph-theory search-algorithms strings sorting-algorithms dynamic-programming geometry mathematics dijkstra search-algorithm tree-algorithms algorithm maxflow adjacency edmonds-karp-algorithm adjacency-matrix nlog matrix-multiplication traveling-salesman

algorithms's Introduction

License: MIT Java CI with Gradle README Checker Donate

Algorithms & data structures project

Algorithms and data structures are fundamental to efficient code and good software design. Creating and designing excellent algorithms is required for being an exemplary programmer. This repository's goal is to demonstrate how to correctly implement common data structures and algorithms in the simplest and most elegant ways.

Contributing

This repository is contribution friendly 😃. If you'd like to add or improve an algorithm, your contribution is welcome! Please be sure to check out the Wiki for instructions.

Other programming languages?

This repository provides algorithm implementations in Java, however, there are other forks that provide implementations in other languages, most notably:

Running an algorithm implementation

To compile and run any of the algorithms here, you need at least JDK version 8. Gradle can make things more convenient for you, but it is not required.

Running with Gradle (recommended)

This project supports the Gradle Wrapper. The Gradle wrapper automatically downloads Gradle the first time it runs, so expect a delay when running the first command below.

If you are on Windows, use gradlew.bat instead of ./gradlew below.

Run a single algorithm like this:

./gradlew run -Palgorithm=<algorithm-subpackage>.<algorithm-class>

Alternatively, you can run a single algorithm specifying the full class name

./gradlew run -Pmain=<algorithm-fully-qualified-class-name>

For instance:

./gradlew run -Palgorithm=search.BinarySearch

or

./gradlew run -Pmain=com.williamfiset.algorithms.search.BinarySearch

Compiling and running with only a JDK

Create a classes folder

cd Algorithms
mkdir classes

Compile the algorithm

javac -sourcepath src/main/java -d classes src/main/java/ <relative-path-to-java-source-file>

Run the algorithm

java -cp classes <class-fully-qualified-name>

Example

$ javac -d classes -sourcepath src/main/java src/main/java/com/williamfiset/algorithms/search/BinarySearch.java
$ java -cp classes com.williamfiset.algorithms.search.BinarySearch

Data Structures

Dynamic Programming

Dynamic Programming Classics

Dynamic Programming Problem Examples

Adhoc

Tiling problems

Geometry

Graph theory

Tree algorithms

Network flow

Main graph theory algorithms

Linear algebra

Mathematics

Other

Search algorithms

Sorting algorithms

String algorithms

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.

Donate

Consider donating to support my creation of educational content:

paypal

algorithms's People

Contributors

williamfiset avatar micahstairs avatar syoon2 avatar abstratt avatar ealexan avatar rushabh-v avatar dependabot[bot] avatar natanel-ziv avatar prashansa-k avatar rohitmazumder avatar ttskym avatar finnlidbetter avatar nishantc1527 avatar tianyishi2001 avatar tejaswgupta avatar khaledsamir avatar ealexa81 avatar atharvathorve avatar dineshsrd avatar c0untzero avatar berkelmas avatar utpalsavliya avatar tuanlinhtl17 avatar swu2050 avatar jasonsaruulo avatar samuelal avatar bhalchandratk avatar bekesibeks avatar bbowles98 avatar askenderski avatar

Stargazers

Luis avatar Nithin Prem avatar  avatar Daniela Naves avatar  avatar Alon Engel avatar Don Arias Agokoli avatar Joël Gnansounou avatar  avatar Foo Bar avatar Michael Monaghan avatar Ashim Gotame avatar SALLA SATHWIK SRIHARSHA avatar SHREESH GUPTA avatar Truong Gia Thanh avatar Iva avatar  avatar  avatar Pranay Vishwakarma avatar  avatar Nicholas_Miyasato avatar Thanh Phu Phan avatar hojat avatar  avatar Kusuma rani sutar avatar  avatar Yamo Akrami avatar  avatar Electra Magus avatar Quan记 avatar Matt Herzog avatar Troy avatar Tadhg Mulvey avatar Teno avatar Kyi Min Khine avatar Patrick avatar Dalveer Singh avatar Kory avatar Edward Citalan avatar  avatar xjt2016 avatar TING WEI JING avatar Sathvik Reddy avatar Izabel Chaves avatar Daniel Gallego avatar Exist avatar  avatar  avatar LBF38 avatar Arman Kumar Aditya avatar Suraj Prajapati avatar Chigbogu avatar koussay0 avatar Walcriz avatar Sahil avatar Muhammad Tanjimul Islam avatar  avatar yuanhang avatar  avatar Chtholly.Ruq.Seniorious avatar WeitingChen avatar Islam Umarov avatar Baraa Mohamed Ahmed avatar Lily Chen avatar  avatar Anmol Tuteja avatar TrackPoint avatar Nivedha Gayatri T avatar kliutvdc avatar  avatar  avatar kamilens avatar João de Araújo avatar Arturo Barrios avatar pallav ranpise avatar x_wh avatar jina avatar Kremsotech avatar Mohamed Ibrahim avatar Arash Mohammadi avatar SniperZk avatar  avatar Andrew Salazar avatar Josephine  avatar  avatar  avatar NicolasM avatar Rahom avatar  avatar dwk avatar  avatar Ahmad Suhail avatar Sav avatar Ahmed Mohamed Salah avatar GarvinRay avatar Li Dapeng avatar Isuru Karunaratna avatar Skyler avatar  avatar Ibrahim Alghrbawy avatar

Watchers

Kevin Dai avatar  avatar  avatar  avatar Richard Lee avatar Michael Hoffer avatar Saurav Sarkar avatar Michael Huynh avatar  avatar Oleg Ievtushok avatar thormy avatar Vishal Kumar Gupta avatar Hafiz Ahmed avatar Apola Kipso avatar iammrallblue avatar  avatar Sanjiv Kumar Sarkar avatar zbyufei avatar Dennis Shih Hwa Lai avatar Praween avatar Roger M avatar woodslee avatar Roman Kolokhanin avatar Kondal Rao Komaragiri avatar ShishirVK avatar Alex Wu avatar Michele Venturi avatar Alexander avatar Alexandre Luís avatar zhangaz1 avatar M. Tong avatar Wilfrido Nuqui Jr. avatar Jeffrey Hu avatar rayworks avatar Nitin Sharma avatar Dahang avatar lslab avatar  avatar Kalyan vadlamani avatar  avatar Dmitry Atamanov avatar Muntasir Raihan Rahman avatar Hoang Tran avatar sferlin avatar  avatar  avatar  avatar  avatar  avatar Gao Hongtao avatar  avatar David Bwire avatar Tim Siwula avatar DJ Rajkhowa avatar kdr avatar André Gustavo de Andrade avatar  avatar Harish Shankar avatar thinking avatar Vanson avatar Hui Zhang avatar  avatar  avatar d3bt3ch avatar hc.chen avatar Gary Cheng avatar  avatar sivanagaraju pachipulusu avatar 吴上阿吉 avatar Carlos Valderrama Vega avatar Zakery Kates avatar  avatar  avatar ZiMo(熊文财) avatar Ythalo Saldanha avatar  avatar  avatar Senthil Kumar avatar Ahmed Ibrahim avatar Yogesh B avatar Dao Le avatar Yusufu Sha avatar  avatar Alexander T avatar Amit Chavan avatar RealForce1024 avatar Irfan Quresh avatar Win Myint Oo avatar 1 avatar Mohammed Mesaoudi avatar Gilles avatar gcfeng avatar Gabriel K. Lu avatar Khosbayar Buyandalai avatar  avatar Pavan kumar avatar Yonghao avatar Emilio Jesús Santos Yerga avatar Vishal Moorthy avatar Angel Ortega (he/they) avatar

algorithms's Issues

Missing Algorithms

Still need to code up and document usage of how to use the following algorithms. Help is of course always appreciated :)

Graph Theory

Tree related

  • Centroid decomposition
  • Heavy-Light decomposition
    • Distance between two nodes
    • Lowest common ancestor
  • Tree Center(s)
  • Tree Diameter
  • Tree Isomorphism/canonical form, O(V+E)
  • Rooting tree

Strings

  • Aho-Corasick
  • Boyer-Moore
  • Burrows Wheeler
  • Longest repeated substring(s)
  • Longest common substring(s)
  • Suffix array LCP Kasai algorithm
  • Suffix array string match O(mlogn)
  • Suffix array string match O(m + logn)
  • Z-Algorithm

Add quickselect algorithm

Add quickselect algorithm. Quickselect is a selection algorithm to find the kth smallest element in an unordered list.

GaussianElimination explanation

In the GaussianElimination.java file it is written that you should check for consistency and/or multiple solutions before trying to solve, however I don't think that the methods correctly do this for an arbitrary matrix. I think that the solve method should be run first in order to put the matrix into reduced row echelon form and from there the isInconsistent and hasMultipleSolutions can be used correctly. Does this look/sound right?

Time complexity

Add time complexity to all algorithms in README for ease of lookup.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.