V2EX  ›  英汉词典

Two-pointer

Definition / 释义

two-pointer(名词)常指:

  1. 双指针(法):算法/编程中的一种技巧,用两个“指针”(通常是数组下标或迭代器)从同向或两端移动,以高效完成查找、去重、滑动窗口等任务。
  2. 两分球(体育语境,尤指篮球):一次得两分的投篮。

Pronunciation / 发音

/ˈtuː ˌpɔɪntər/

Examples / 例句

The two-pointer method can find a pair that sums to the target quickly.
双指针法可以很快找到和为目标值的一对数。

By advancing one pointer to shrink the window and the other to expand it, the two-pointer approach reduces the time complexity from O(n²) to O(n) for many array problems.
通过移动一个指针来缩小窗口、另一个指针来扩展窗口,双指针思路在许多数组问题中能把时间复杂度从 O(n²) 降到 O(n)。

Etymology / 词源

two(两个)+ pointer(指针)构成。pointer 来自 point(指向、标记),在编程语境里常指“指向数据位置的引用/索引”;因此 two-pointer 字面义就是“两个指针协同移动”。在体育语境中则是“得两分的投篮”。

Related Words / 相关词

Literary Works / 文学与作品例

  • Cracking the Coding Interview(常见面试题解中频繁使用双指针处理数组/字符串)
  • Elements of Programming Interviews(多处以 two-pointer 思路讲解数组与字符串题)
  • Competitive Programming 4(竞赛编程章节中常把双指针作为基础技巧之一)
  • Guide to Competitive Programming(算法技巧部分涉及双指针与滑动窗口的典型用法)
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1779 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms · UTC 11:10 · PVG 19:10 · LAX 03:10 · JFK 06:10
♥ Do have faith in what you're doing.