V2EX  ›  英汉词典
Enqueued related words: Two Pointers, Subarray, Hash Map

Sliding Window

Definition / 定义

sliding window滑动窗口。一种常见的算法思路:在数组、字符串或时间序列上维护一个“窗口”(连续区间),通过窗口的移动与增减元素来高效计算满足条件的子区间/子串(如最长/最短、计数、和、频率等)。常用于“双指针”与“流式数据”场景。(在网络通信中也可指“滑动窗口协议”,属于另一常见含义。)

Pronunciation / 发音

/ˈslaɪdɪŋ ˈwɪndoʊ/

Examples / 例句

We used a sliding window to find the longest substring without repeating characters.
我们用滑动窗口来找出不含重复字符的最长子串。

By maintaining counts inside the sliding window and moving its boundaries, the algorithm runs in linear time instead of quadratic time.
通过在滑动窗口内维护计数并移动左右边界,该算法从平方级复杂度降为线性时间。

Etymology / 词源

sliding 来自动词 slide(滑动、滑行),window 原义为“窗/窗口”。在算法语境中,“window(窗口)”比喻“当前正在观察或处理的一段范围”,而“sliding(滑动)”强调这段范围会沿着数据逐步移动,因此形成“sliding window(滑动窗口)”这一形象说法。

Related Words / 相关词汇

Literary Works / 文学作品

  • Cracking the Coding Interview(Gayle Laakmann McDowell)——常以“sliding window”讲解字符串/数组题型思路。
  • Elements of Programming Interviews(Adnan Aziz 等)——包含以滑动窗口解决子串、区间统计等问题的题解与讨论。
  • Competitive Programming(Steven Halim 等)——在区间与序列相关章节中常出现滑动窗口/双指针技巧。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1904 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 07:57 · PVG 15:57 · LAX 23:57 · JFK 02:57
♥ Do have faith in what you're doing.