Data Structures & Algorithms

Two-Pointer Technique

/tuː ˈpɔɪntər tekˈniːk/

Definition

An algorithm pattern using two index pointers moving towards each other or in the same direction to solve array problems in O(n).

Example in context

"The 'find pair that sums to target' problem: sort the array, then shrink the window with two pointers from both ends."

Related terms

Practice this term

Master Two-Pointer Technique in context by working through exercises in the Data Structures & Algorithms module. You'll see the term used in real engineering scenarios with multiple-choice, fill-in-the-blank, and matching drills.