2TREES AND RECURSION
In this chapter, we’ll look at two problems that will require processing and answering questions about hierarchical data. The first problem is about collecting candy from a neighborhood. The second concerns queries on family trees. Because loops are a natural means to process collections of data, we’ll try them first. We’ll soon see, though, that these problems push against what we can easily express with loops, and this will motivate a shift in the way we think about and solve such problems. You’ll leave this chapter knowing about recursion, a problem-solving technique that applies whenever the solution to a problem involves ...
Get Algorithmic Thinking, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.