Back to rankings

williamfiset/algorithms

Java

A collection of algorithms and data structures

algorithmslinear-algebragraph-theorysearch-algorithmsstringssorting-algorithmsdynamic-programminggeometrymathematicsdijkstrasearch-algorithmtree-algorithms
Star Growth
Stars
18.7k
Forks
4.5k
Weekly Growth
Issues
30
5k10k15k
May 2017May 2020Jun 2023Jul 2026
ArtifactsMavengit clone https://github.com/williamfiset/algorithms.git
README

License: MIT Bazel Tests README Checker Sponsor

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.

🎬 Many of the algorithms and data structures in this repo have companion video explanations on the William Fiset YouTube channel — so if the code alone doesn't click, grab some popcorn and watch the videos!

Running an algorithm implementation

To compile and run any of the algorithms here, you need at least JDK version 8 and Bazel

This project uses Bazel as its build system. Install Bazel by following the official installation guide.

Run a single algorithm like this:

bazel run //src/main/java/com/williamfiset/algorithms/<subpackage>:<ClassName>

For instance:

bazel run //src/main/java/com/williamfiset/algorithms/search:BinarySearch

Run all tests:

bazel test //src/test/...

Run tests for a specific package:

bazel test //src/test/java/com/williamfiset/algorithms/sorting:all

Compiling and running with only a JDK

If you don't want to use Bazel, you can compile and run with just the 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

More geometry algorithms

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.

Sponsor

Consider sponsoring to support my creation of educational content:

Sponsor

Related repositories
jwasham/coding-interview-university

A complete computer science study plan to become a software engineer.

Creative Commons Attribution Share Alike 4.0 Internationalcomputer-scienceinterview
356.7k84.3k
trekhleb/javascript-algorithms

📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings

JavaScriptnpmMIT Licensejavascriptalgorithms
196.3k31k
yangshun/tech-interview-handbook

Curated coding interview preparation materials for busy software engineers

TypeScriptnpmMIT Licenseinterview-questionscoding-interviews
techinterviewhandbook.org
141.1k16.7k
labuladong/fucking-algorithm

Crack LeetCode, not only how, but also why.

Markdownleetcodealgorithms
labuladong.online
134.9k23.6k
krahets/hello-algo

《Hello 算法》:动画图解、一键运行的数据结构与算法教程。支持简中、繁中、English、日本語,提供 Python, Java, C++, C, C#, JS, Go, Swift, Rust, Ruby, Kotlin, TS, Dart 等代码实现

JavaMavenOtheralgorithmsdata-structures
hello-algo.com
128.6k15.3k
Developer-Y/cs-video-courses

List of Computer Science courses with video lectures.

computer-sciencealgorithms
82.6k11.4k
TheAlgorithms/Java

All Algorithms implemented in Java

JavaMavenMIT Licensejavaalgorithms
66k21.2k
kdn251/interviews

Everything you need to know to get the job.

JavaMavenMIT Licensejavainterview
youtube.com/channel/UCKvwPt6BifPP54yzH99ff1g
65.1k12.9k
azl397985856/leetcode

LeetCode Solutions: A Record of My Problem Solving Journey.( leetcode题解,记录自己的leetcode解题之路。)

JavaScriptnpmOtheralgorithmleetcode
leetcode-solution-leetcode-pp.gitbook.io/leetcode-solution/
55.8k9.4k
doocs/leetcode

🔥LeetCode solutions in any programming language | 多种编程语言实现 LeetCode、《剑指 Offer(第 2 版)》、《程序员面试金典(第 6 版)》题解

JavaMavenCreative Commons Attribution Share Alike 4.0 Internationalalgorithmscpp
leetcode.doocs.org
36.3k9.4k
geekxh/hello-algorithm

🌍 针对小白的算法训练 | 包括四部分:①.大厂面经 ②.力扣图解 ③.千本开源电子书 ④.百张技术思维导图(项目花了上百小时,希望可以点 star 支持,🌹感谢~)推荐免费ChatGPT使用网站

JavaMavenalgorithmsinterview-questions
lintcode.com/chat-gpt
36.1k6.4k
TheAlgorithms/JavaScript

Algorithms and Data Structures implemented in JavaScript for beginners, following best practices.

JavaScriptnpmGNU General Public License v3.0algorithmalgorithm-challenges
the-algorithms.com/language/javascript
34.2k5.9k