main-content

Python Algorithms, Second Edition explains the Python approach to algorithm analysis and design. Written by Magnus Lie Hetland, author of Beginning Python, this book is sharply focused on classical algorithms, but it also gives a solid understanding of fundamental algorithmic problem-solving techniques.

The book deals with some of the most important and challenging areas of programming and computer science in a highly readable manner. It covers both algorithmic theory and programming practice, demonstrating how theory is reflected in real Python programs. Well-known algorithms and data structures that are built into the Python language are explained, and the user is shown how to implement and evaluate others.

### Chapter 1. Introduction

■■■
Magnus Lie Hetland

### Chapter 2. The Basics

■■■
Magnus Lie Hetland

### Chapter 3. Counting 101

■■■
Magnus Lie Hetland

### Chapter 4. Induction and Recursion ... and Reduction

You must never think of the whole street at once, understand? You must only concentrate on the next step, the next breath, the next stroke of the broom, and the next, and the next. Nothing else.
Magnus Lie Hetland

### Chapter 5. Traversal: The Skeleton Key of Algorithmics

■■■
Magnus Lie Hetland

### Chapter 6. Divide, Combine, and Conquer

■■■
Magnus Lie Hetland

### Chapter 7. Greed Is Good? Prove It!

It’s not a question of enough, pal.
Magnus Lie Hetland

### Chapter 8. Tangled Dependencies and Memoization

Twice , adv. Once too often.
Magnus Lie Hetland

### Chapter 9. From A to B with Edsger and Friends

■■■
Magnus Lie Hetland

### Chapter 10. Matchings, Cuts, and Flows

■■■
Magnus Lie Hetland

### Chapter 11. Hard Problems and (Limited) Sloppiness

■■■
Magnus Lie Hetland

### Appendix A. Pedal to the Metal: Accelerating Python

■■■
Magnus Lie Hetland

### Appendix B. List of Problems and Algorithms

■■■
Magnus Lie Hetland

### Appendix C. Graph Terminology

■■■
Magnus Lie Hetland

### Appendix D. Hints for Exercises

■■■
Magnus Lie Hetland