|
|
|
|
|
by lupire
1461 days ago
|
|
Why would you think enumerating a directory is not magic? Walking a tree / BFS is quite easy to implement iteratively, using a search queue.
It's a common example for teaching Lisp. Recursion is most natural in problems like implementing evaluation of an abstract syntax trer: eval(tree) =
apply(node(tree),
map(eval, leaves(tree))
)
|
|
O(n^2) but very simple.