V2EX  ›  英汉词典
Enqueued related words: For Loop, While Loop

Nested Loop

定义 Definition

nested loop(嵌套循环):在一个循环结构的循环体内再包含另一个循环(甚至多层循环)。常用于处理二维/多维数据、生成组合、遍历表格或矩阵等。编程语境中也常提示时间复杂度可能增加(例如从 (O(n)) 变为 (O(n^2)))。

发音 Pronunciation (IPA)

/ˈnɛstɪd luːp/

例句 Examples

A nested loop prints a 10-by-10 multiplication table.
嵌套循环可以打印一张 10×10 的乘法表。

Because the algorithm uses a nested loop to compare every pair of items, its running time grows quickly as the list gets larger.
由于该算法用嵌套循环来比较每一对元素,列表越大运行时间增长越快。

词源 Etymology

nested 来自 nest(“巢”),引申为“像套在巢里一样层层包裹、置于内部”;loop 原意为“环、圈”,在计算机语境中表示“循环执行的一段结构”。合起来 nested loop 形象地表达“循环里面再套一个循环”。

相关词 Related Words

文学与著作 Literary Works

  • Introduction to Algorithms(《算法导论》)——在分析双重循环/嵌套循环时常用于说明渐进时间复杂度(如 (O(n^2)))。
  • The C Programming Language(《C 程序设计语言》)——通过示例程序展示 for 循环嵌套来处理表格、字符或数组遍历。
  • Clean Code(《代码整洁之道》)——讨论可读性与复杂度时,会提到应谨慎使用多层嵌套结构(包括嵌套循环)。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   945 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 17:33 · PVG 01:33 · LAX 09:33 · JFK 12:33
♥ Do have faith in what you're doing.