(no title)
Aozora7 | 3 years ago
I think recursion should be taught with examples that would be easier for a student to write with recursion than without it. For example, listing all files in a directory.
Aozora7 | 3 years ago
I think recursion should be taught with examples that would be easier for a student to write with recursion than without it. For example, listing all files in a directory.
lupire|3 years ago
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:
DeathArrow|3 years ago
O(n^2) but very simple.
usrn|3 years ago
dgfitz|3 years ago
[deleted]
unknown|3 years ago
[deleted]