Aug. 13, 2010
8:11 a.m.
Scott Dial wrote:
Yes, I think even something as trivial as an example in-order iteration over a binary tree should be included since it is accessible and the benefits of readability, efficiency, and correctness are apparent:
That's a nice example -- I've just added it to the web page (with appropriate attribution).
while also being agnostic to whether left/right is also a BinaryTree object (e.g., a tuple or list or some other user-defined type works just as well as an iterable leaf) -- a feat that would be rather complicated and verbose otherwise.
That's not actually true -- a for-loop would work with any iterable node object just as well. -- Greg