java-algorithms-implementation
Algorithms and Data Structures implemented in Java
A readable collection of classic algorithms and data structures in Java, covering sorting, graphs, trees, and more, designed for learning computer science fundamentals and interview prep.
java-algorithms-implementation is a collection of classic algorithms and data structures written in Java by Justin Wetherell. The author describes it as material he has implemented over his academic and professional career. The code is written to be correct and readable rather than optimized for maximum performance, and all implementations are tested.
The data structures covered include a wide range of tree types (AVL, B-Tree, Red-Black, Splay, Treap, Patricia Trie, Suffix Tree, and others), along with standard structures like hash maps, queues, stacks, lists, and matrices, plus more specialized ones like KD-Trees, Interval Trees, and Fenwick Trees. Both directed and undirected graph types are included.
Algorithm categories include: sorting, graph algorithms (shortest path via Dijkstra and Bellman-Ford, minimum spanning tree via Prim and Kruskal, cycle detection, topological sort, connected components), search algorithms, string functions, and mathematical operations such as prime testing, greatest common divisor, permutations, modular arithmetic, and the knapsack problem.
This kind of reference collection is useful as a study aid for people learning computer science fundamentals, as a refresher for developers preparing for technical interviews, or as readable source code to consult when you need to understand how a specific algorithm works before adapting it. The README does not describe a library packaging system or build tooling; it is primarily a source code reference organized by category.
The project was created and is maintained by Justin Wetherell.
Where it fits
- Study classic data structures like AVL trees, Red-Black trees, and KD-Trees by reading clean, tested Java code.
- Prepare for technical interviews by reviewing implementations of sorting, graph shortest-path, and dynamic programming algorithms.
- Look up how a specific algorithm works, such as Dijkstra or Kruskal, before adapting it to your own project.
- Refresh your understanding of mathematical algorithms like GCD, modular arithmetic, and the knapsack problem.