A focused collection of algorithms implemented from scratch in Kotlin. Built for learning, interview preparation, and understanding how common algorithms work.
The implementations favor readable, textbook-style code, explicit control flow, and tests that demonstrate expected behavior.
- Array adjacency list — adjacency lists for integer vertices.
- Map adjacency list — adjacency lists for generic vertex identifiers.
- Adjacency matrix — matrix-backed graph for integer vertices.
- Breadth-first search — iterative BFS.
- Depth-first search — iterative and recursive DFS.
- Graph paths — BFS and DFS path reconstruction.
- Connected components
- Cycle detection — directed and undirected graphs.
- Bipartite checking
- Bridges
- Articulation points
- Strongly connected components — Kosaraju's algorithm.
- Topological sorting — DFS and Kahn's algorithm.
- DAG shortest paths
- DAG longest paths
- Grid — coordinates, movement directions, and neighbor calculation.
- Grid paths — BFS pathfinding over an implicit grid graph.
- Bubble sort
- Selection sort
- Insertion sort
- Merge sort
- Quick sort
- Heap sort
- Heap sort using PriorityQueue
- Binary search — iterative and recursive implementations.
./gradlew testInspired by William Fiset and Donglai Fu.