Where will I use this?
This book was not written because this information is missing. It is everywhere: classic textbooks, thousands of LeetCode solutions, videos for every single problem. If you only want the answer to Two Sum, you do not need one more book.
Where will I use this?
When I was learning this myself, one question never left my head: where will I ever use this? Reversing a linked list, balancing a tree, finding a cycle in a graph. It all felt like puzzles made for interviews, with no link to the real work I was doing every day. I learned the trick, passed the test and forgot it a month later, because I never saw it anywhere else.
The answer, it turns out, is: everywhere. The biggest and most serious software we run is built on exactly these basics.
Linux runs on the basics
Take the Linux kernel, the code under almost every server, phone and router:
- Linked lists:
struct list_headties together processes, devices, modules and almost everything else the kernel tracks. - Hash tables: the dentry cache finds a file by name in a hash of
hlistchains, which is why opening the same path twice is fast. - Red-black trees: the CPU scheduler keeps runnable tasks in an
rbtreeto pick the next one, andepollkeeps the watched sockets in one. - Queues and ring buffers:
kfifomoves data between producer and consumer without a lock. - Tries: IPv4 routing looks up every packet's next hop in an LC-trie,
net/ipv4/fib_trie.c. - Graphs and DFS: the BPF verifier walks every program as a graph and rejects it if it finds a loop it cannot prove ends.
- Binary search, heaps and bits:
lib/bsearch.c,min_heap.hand thecpumaskbitmaps are small, plain and used all over the tree.
Once you see this, the basics stop being interview trivia. They become a way to read real code, to understand why one system is fast and another is slow, and to debug production when it is not your code that is broken but your guess about how it works. Passing the interview becomes a side effect.
That is why every problem in this book ends with one more part: In real code, where the same structure or trick lives in software you already use. My hope is that you never have to ask "where will I use this?", because the answer is right next to the solution.