Designed for use in introductory- or intermediate-level courses in data structures and algorithms, this book has modest prerequisites: familiarity with high school mathematics and an acquaintance with some procedural or object-oriented programming language, by which the authors mean having an understanding of variables, expressions, for and while loops, and functions or methods. Prior experience with Python is not required, as chapter 1 amounts to a primer on the basics of the language.
The material includes the concepts one would expect: stacks, queues, linked lists, trees, maps, hash tables, sorting, and graph algorithms. But there are also chapters on object-oriented programming, algorithmic analysis, recursion, search trees, graph algorithms, and B-trees. For good measure, examples are given for applications such as processing file systems, matching Hypertext Markup Language (HTML) tags, elementary cryptography, text frequency analysis, automated geometric layout, Huffman encoding, DNA sequence alignment, and search engine indexing. Clearly, to cover all this material in one semester, the instructor will need to either proceed at a rapid clip or designate sections to be covered in class and sections for outside reading.
What sets this book apart is the approach taken by the authors: the presentation is centered on the specification of abstract data structures. From these, Python code is developed in strict object-oriented fashion, with data structures encapsulated in classes and algorithms expressed as class methods. When appropriate, different implementation strategies are detailed, such as arrays or linked lists for stacks and queues. Nearly all of the algorithms are presented as Python code fragments, which the reader must encapsulate in appropriate code to make an executable program.
The chapter on algorithmic analysis deserves special mention. The topic is growth rates, and the authors present seven functions for the analysis: constant, logarithmic, linear, n-log-n, quadratic, polynomial, and exponential. For asymptotic analysis, the authors introduce big O, big omega, and big theta notations, with exceptionally clear explanations and examples. In subsequent chapters, the efficiency of the algorithms under study is given, but not analyzed, using the big O notation.
The book provides plenty of exercises at the end of each chapter. These fall into one of three categories: reinforcement, creativity, or projects. In many places, the authors use creativity exercises to present significant material, without any hints on how to proceed. In reality, most students will solve these problems by searching the Internet for existing solutions, perhaps translating found solutions into Python. Nevertheless, the quantity and quality of exercises is very good; students should be encouraged to work on as many as they can, and to read the rest and at least mentally plan an approach.
The publisher’s website contains all of the Python code shown in the book, plus solutions to many (but not all) of the exercises, color versions of the black-and-white photos and illustrations in the book, and slides in PowerPoint and portable document format (PDF). Some of this material, intended for instructors, requires registration. A summary of errata is not provided.
This textbook reflects the in-class experience of two of the three authors, who authored two previous books in the series [1,2]. However, this book does not simply translate either of the previous books into Python. The material, and especially the code, has been significantly redesigned and reorganized. Plus, the authors acknowledge the copious comments they have received from reviewers and readers.
In a very real sense, this is a mature book that deserves consideration from instructors who wish to teach Python at this level. But I’m left with the feeling that Python may be more the language of current fashion than the optimal language for studying algorithms and data structures. I don’t object to Python per se, but while reading this book, I sometimes had the feeling that the Python code was developed nearly ex nihilo, dictated more by language considerations than by a logical progression of incremental development from abstract data structure to executable code. In that respect, of course, Python is not unique.
In summary, I found this to be a solid book, worthy of joining the pool of textbooks on data structures and algorithms.