SpanMode.breadth -- misnomer?
spir
denis.spir at gmail.com
Sat Mar 12 01:31:23 PST 2011
On 03/12/2011 10:22 AM, %u wrote:
> It seems to me that the SpanMode.breadth option when enumerating a
> directory does not actually do breadth-first search, but rather
> performs a kind of depth-first "preorder" traversal.
>
> In other words, to me, this is depth-first "postorder" traversal:
>
> \A
> \A\1
> \A\1\x
> \A\1\y
> \A\2
> \B
> \B\1
>
> whereas this is depth-first "preorder" traversal:
>
> \A\1\x
> \A\1\y
> \A\1
> \A\2
> \A
> \B\1
> \B
>
> and whereas **this** is a true breadth-first traversal:
>
> \A
> \B
> \A\1
> \A\2
> \B\1
> \A\1\x
> \A\1\y
>
>
> Is that correct, and so is "breadth" actually a misnomer? I found it
> really confusing that it didn't work level-by-level.
You are right about depth / breadth.
(But I also have always found preorder/postorder misleading, or rather
inversed. For me, the second one should be called postorder, since it postpones
app on A after app on A's subnodes. A better, non-misleading, naming may be
branch-first (case 1 above) vs children-first (case 2).)
Denis
--
_________________
vita es estrany
spir.wikidot.com
More information about the Digitalmars-d
mailing list