On 2009-04-26 11:21:54 -0400, dsimcha <dsim...@yahoo.com> said:

2.  You can't iterate over a binary tree in O(1) auxiliary space, at least not
in any way I'm aware of.  This means that a lazy range to iterate over the
keys or values is relatively useless because it would generate heap activity
anyhow to store the stack or queue necessary to iterate over the tree, so you
may as well just use the current .keys or .values properties, which just
return an array.  (Because of the way that ranges are designed, you can't just
use the call stack, unless you use fibers or something, which is obviously not
a win from an efficiency point of view.)

Hum, are you saying opApply superior when it comes to iterating in a tree? It seems that with opApply you could use the stack by recursively calling opApply with the given delegate on each one of the branches.

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to