Книга: A Common-Sense Guide to Data Structures and Algorithms in Python, Volume 1
Назад: Filesystem Traversal
Дальше: Exercises

Wrapping Up

As you’ve seen with the filesystem example, recursion is often a great choice for an algorithm in which the algorithm needs to dig an arbitrary number of levels deep into something.

You’ve now seen how recursion works and how incredibly useful it can be. You’ve also learned how to walk through and read recursive code. However, most people have a difficult time writing their own recursive functions when they’re first starting out. In the next chapter, we’ll explore techniques to help you learn to write recursively. Along the way, you’ll also discover other important use cases where recursion can be an incredible tool.

Назад: Filesystem Traversal
Дальше: Exercises