# Practical Algorithms and Data Structures

This book is a practical—and, we hope, entertaining—introduction to some of the most important algorithms and data structures in computer science.

We have written the examples in this book in idiomatic Python to help
convey the *usefulness* of these algorithms and data structures, both
directly and as models for analogous work that you will do.

Many software engineers are skeptical that this subject matter is useful; our best explanation for such skepticism is that those engineers never encountered these topics in a way that encouraged deep understanding. Perhaps they were unfortunate enough to participate in a computer science program that encouraged rote memorization or subjected themselves to such an experience for the sake of succeeding at technical interviews. Or perhaps they became adequate programmers without having encountered the content at all and presume that they have reached the limits of their capabilities.

Whatever the case, we’re confident that the usefulness of algorithms and data structures is proportional to the depth at which you understand it. Those who study trees are more likely to identify tree shapes in their own data, unlocking superior solutions to their problems. Those who see recursion everywhere see recursion everywhere. Those who have big O analysis in their toolkits not only have a better vocabulary for comparing alternative strategies, they are also more generally cognizant of the trade-offs we implicitly make every day.

One trade-off that *we* have made is to sacrifice breadth for the sake
of depth; we cover fewer algorithms and data structures than a typical
introductory text may cover in order to focus more on what we consider
to be important. For instance, we do not cover sorting algorithms,
a topic that rarely arises in practice, at all; instead, we spend more time
walking you through interesting applications of tree and graph traversal
algorithms. For this reason, we recommend that you work through the examples
slowly, with an open REPL or text editor, verifying that you are absorbing
the content so you can use these abstractions throughout your career.