Preface

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:

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.

← ContentsChapter 1: Data Structures →