这两个函数均按照深度优先的顺序遍历树,但两者的差异在于先访问一个节点还是先访问其子节点。
Both functions walk the tree in depth-first order but they differ in whether a node is visited before or after its children.
如果既没有指定过滤器又没有指定比较器,枚举将以未定义的顺序遍历记录存储中的所有记录。
If neither the filter nor the comparator are specified, the enumeration will traverse all records in the record store in an undefined order.
在某些情况下,我们实际可能希望按照相反的顺序遍历这些节点、跳过某些节点或子树或其他一些内容。
In some cases, we may actually want to traverse these nodes in the reverse order, skip certain nodes or subtrees, or something else.
而且,令人感兴趣的是,DB2返回结果时所依照的顺序暴露了递归如何逐层地而不是采用遍历树的方法进行处理。
Further, it is interesting to note that the order in which DB2 has returned the results exposes how the recursion is processed one level at a time, instead of using a tree-walk.
在Revelytix中,我们始终按照zippers枚举深度优先的顺序遍历节点。
At Revelytix, we always traverse the nodes in the depth-first order of the zipper enumeration.
zippers的枚举函数允许您按照深度优先的顺序遍历整个树,如图11所示。
A zipper's enumeration functions allow you to traverse the entire tree in depth-first order, as shown in Figure 11.
正如您所见到的,该文件是深度优先遍历,但不一定在任何目录内按字母顺序来进行。
As you can see, the file traversal is depth first but not necessarily in any alphabetical order within a directory.
这就引出了一个有意思的问题:上面给出的结果在多大程度上依赖于按顺序遍历integers?
This brings up an interesting point: how much do the results I've presented above depend on the fact that integers is being iterated through in order?
但是向后移动要复杂些,因为迭代器内部执行的是深度优先算法,预先排好了Rope遍历的顺序,需要访问每个叶节点。
But moving backward is more complicated, because internally the iterator performs a depth-first, preorder traversal of the Rope, visiting each of its leaf nodes.
以任意顺序对每个物品进行遍历。
以任意顺序对每个物品进行遍历。
应用推荐