January 2020
Intermediate to advanced
470 pages
11h 13m
English
Data structures, which include recursion in their definition, are naturally appropriate for recursive techniques. Let's consider, for example, how to traverse a complete filesystem directory, listing all of its contents. Where's the recursion? The answer is clear if you consider that each directory can do either of the following:
Let's work out a full recursive directory listing—meaning that when we encounter a directory, we also list its contents, and if those include more directories, we also list them, and so on. We'll be using the same node functions as in getDir() (from the ...
Read now
Unlock full access