A focused collection of data structures implemented from scratch in Kotlin. Built for learning, interview preparation, and understanding the trade-offs behind the abstractions used every day.
Each implementation favors readable code, clear APIs, and tests that demonstrate expected behavior.
- Dynamic arrays — resizable arrays and circular buffers.
- Linked lists — singly and doubly linked lists.
- Stacks — array-, linked-list-, and queue-backed stacks.
- Queues and deques — array-, linked-list-, and stack-backed queues, deques, and monotonic queues.
- Trees — tree nodes and traversal algorithms.
- Binary search trees — ordered trees and reconstruction.
- AVL trees — self-balancing binary search trees.
- Heaps — binary and d-ary min heaps.
- Union-find — path compression with union by rank or size.
- Binary indexed trees — efficient prefix-sum queries and updates.
- Hash tables — separate chaining and linear-probing strategies.
- Hash sets — a map-backed set implementation.
- Tries — prefix trees for string lookup.
- Suffix arrays — slow, medium, and optimized constructions, plus string-search problems.
./gradlew testInspired by William Fiset and Donglai Fu.