What’s inside.
Each chapter has a complete program to run, the time and memory cost, and exercises.
- 00
Install Go and prepare your workspace
Set up Go, a terminal and an editor, and run your first program.
- 01
Go foundations for DSA
Enough Go for your first algorithms: variables, conditions, loops, functions and slices.
- 02
Maps and sets
Count values, test membership, and replace a repeated scan with a lookup.
- 03
Strings, bytes and runes
Pick bytes, runes or characters so text algorithms count the right thing.
- 04
Structs and pointers
Model linked nodes and see the difference between a struct value and a pointer.
- 05
Recursion
Find the smaller problem and the stopping condition, and count the stack space.
- 06
- 07
- 08
Hash tables and Go maps
How a key finds its slot, what happens on a collision, and what a map lookup really costs.
See hash tables visualized - 09
Trees and binary search trees
Tree vocabulary, three depth-first traversals, and when a BST is actually fast.
See trees visualized - 10
Heaps and priority queues
Implement a min-heap and recognise Go’s container/heap interface.
See heaps visualized - 11
Searching and sorting
Binary search without off-by-one mistakes, and what sorting costs.
- 12
Two pointers, sliding windows and prefix sums
Three ways to stop rescanning the same elements, and when each one applies.
- 13
Divide and conquer and backtracking
Split a problem into smaller ones, and search choices while undoing each cleanly.
- 14
- 15
Greedy algorithms and their limits
When locally best choices give the best answer, and how to justify the rule.
- 16
Dynamic programming: state, recurrence and cost
Define a state, write the recurrence and base cases, and compute the cost.
- 17
Mixed practice and small Go projects
Choose a technique without a chapter title to help, and build a small route finder.
Prefer another language? JavaScript for DSA, Python for DSA, Java for DSA or C++ for DSA.