Study how to implement classic data structures like AVL trees, hash tables, and segment trees correctly.
Learn graph algorithms such as Dijkstra's shortest path and network flow by reading clean Java code.
Prepare for coding interviews by reviewing implementations of dynamic programming and sorting algorithms.
Reference elegant solutions for string processing, geometry, and union-find problems.
This repository is a large collection of algorithms and data structures implemented in Java, aimed at demonstrating how to build common computer science building blocks correctly and clearly. Algorithms are step-by-step procedures for solving problems; data structures are the organized ways of storing data those algorithms operate on. The collection covers a wide range of topics. On the data structure side it includes trees (AVL, Red-Black, Binary Search, Splay), linked lists, queues, stacks, hash tables with multiple collision-handling strategies, priority queues, segment trees, sparse tables, suffix arrays, tries, and union-find. On the algorithm side it covers dynamic programming (coin change, knapsack, longest common subsequence, matrix chain multiplication, and more), graph algorithms (shortest paths, network flow, strongly connected components, Dijkstra, Bellman-Ford, Floyd-Warshall), sorting algorithms, searching, geometry, and string processing. Many of the implementations have companion video explanations on a YouTube channel, so if reading the code alone isn't enough, video walkthroughs are available. The project uses Bazel as its build system; you need at least Java version 8 and Bazel installed to compile and run anything. Individual algorithms can be run directly from the command line. The stated goal is to show the simplest and most elegant possible implementation of each concept, making it useful as a learning reference.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.