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
Stacks and queues
Newest first or oldest first, built on slices, with the memory trap in slice queues.
- 07
Linked lists
Build a singly linked list, trace pointer changes, and know when a list is worth it.
- 08
Hash tables and Go maps
How a key finds its slot, what happens on a collision, and what a map lookup really costs.
- 09
Trees and binary search trees
Tree vocabulary, three depth-first traversals, and when a BST is actually fast.
- 10
Heaps and priority queues
Implement a min-heap and recognise Go’s container/heap interface.
- 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
Graph traversal with BFS and DFS
Represent a graph, visit each vertex once, and find shortest paths with BFS.
- 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.