V2EX  ›  英汉词典
Enqueued related words: Tree Traversal, Inorder, Postorder

Level-Order Traversal

释义 Definition

层序遍历 / 按层遍历:一种树(尤其是二叉树)的遍历方式,按照“从上到下、从左到右”的层级顺序访问节点。通常使用队列(queue)来实现。
(也常被称为 breadth-first traversal / breadth-first search, BFS 在树上的应用。)

发音 Pronunciation (IPA)

/ˈlɛvəl ˈɔːrdər ˈtrævərsəl/

例句 Examples

We used level-order traversal to print the tree level by level.
我们用层序遍历把这棵树按层打印出来。

To compute the average value of each depth, the program performs a level-order traversal using a queue and records sums per level.
为了计算每一层(每个深度)的平均值,程序用队列进行层序遍历,并按层统计总和。

词源 Etymology

level-orderlevel(“层级、水平”)+ order(“顺序”)组成,强调“按层级的顺序”。traversal 来自 traverse(“穿过、走遍”),在计算机科学中引申为“遍历(数据结构中的所有节点)”。合起来就是“按层走遍整棵树”的方法。

相关词 Related Words

文学与经典作品用例 Literary Works

  • Introduction to Algorithms(Cormen, Leiserson, Rivest, Stein,常称 CLRS):在树与图的遍历相关章节讨论 BFS,并常以树的“按层访问”来解释其思想(层序遍历可视为 BFS 在树上的形式)。
  • Algorithms(Robert Sedgewick & Kevin Wayne):在树与图的基础遍历内容中介绍 BFS,并以“按层次访问节点”的方式呈现相关概念。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   868 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 43ms · UTC 23:37 · PVG 07:37 · LAX 15:37 · JFK 18:37
♥ Do have faith in what you're doing.