A curated collection of data structures, algorithms, and problem solutions implemented in Go to help you prepare confidently for coding interviews.
- Practical, bite-sized implementations with clear naming and idiomatic Go code.
- Topic-driven layout (arrays, graphs, dynamic programming, heaps, etc.) that mirrors common interview patterns.
- Reference tests and examples so you can validate your understanding as you go.
- Ready-to-run Go modules and a Makefile for streamlined practice sessions.
- Go 1.20 or newer
- Make (optional, for convenience targets)
git clone https://github.com/shani1998/data-structures.git
cd data-structuresgo test ./...
# or
make testmake fmt| Folder | What you will find |
|---|---|
array/ |
Sliding window, backtracking, dynamic programming, and classic array questions. |
graph/ |
Traversal templates (BFS/DFS), adjacency representations, and graph interview problems. |
hashing/ |
Hash map patterns, frequency counting, and common interview puzzles. |
heap/ |
Priority queue implementation and a max-heap backed by arrays. |
linkedlist/ |
Singly and doubly linked list utilities, plus test-backed problems. |
queue/, stack/ |
Core abstract data type implementations with unit tests. |
tree/, trie/ |
Binary tree traversals, BST helpers, segment tree snippets, and trie utilities. |
examples/ |
Small reference programs demonstrating how to wire the data structures together. |
Use the directory names as search anchors during practice sessions. Each subfolder mirrors a pattern you are likely to meet in interviews.
array/- Array & Sequence Patternsgraph/- Graph Algorithms Playbookhashing/- Hashing & Frequency Patternsheap/- Heaps & Priority Queueslinkedlist/- Linked List Systemsqueue/- Queue Patterns & Schedulingstack/- Stack Techniques & Recursion Toolstree/- Tree Structures & Traversalstrie/- Prefix Tree Overview
- Warm up with the foundational ADTs (
stack/,queue/,linkedlist/). - Practice traversal templates in
tree/andgraph/- they unlock many medium problems. - Dive into
array/anddp/folders to cover sliding window, prefix sums, and dynamic programming staples. - Challenge yourself with the
questions/subfolders that mimic real interview prompts. - Revisit topics weekly; run the tests to confirm muscle memory.
| Concept | Everyday example |
|---|---|
| Stack | Undo operations, browser history backtracking, recursion call stacks. |
| Queue | Background job scheduling, recently deleted photos, waitlists. |
| Linked List | Browser navigation, playlist sequencing, circular turn order in board games. |
| Tree | File systems, e-commerce category hierarchies, autocomplete tries. |
| Graph | Ride sharing route matching, dependency resolution, social network friend suggestions. |
- Fork the repository and create a feature branch.
- Add clear problem statements or comments when introducing new solutions.
- Include unit tests (
go test ./...) when you add or refactor code. - Run
make fmtbefore opening a pull request to keep the style consistent. - Share learnings by updating this README or adding notes in
resources.mdfiles where relevant.
graph/resources.md- curated articles on graph theory fundamentals.array/dp/README.mdandarray/slidingwindow/README.md- topic-focused notes.examples/README.md- walkthroughs for combining multiple data structures.extras/golang-dsa/README.md- notes on the migrated legacy practice set.
If this toolkit helps you ace an interview, consider opening an issue with your story or adding the problem you solved. Happy studying!