Skip to content

Glossary: Algorithms Beyond the Basics

Two pointers

Also written: two-pointer

A pattern that keeps two indexes into one list, either moving in from both ends of a sorted list to find a pair or moving the same way. It gives O(n) time with O(1) extra memory.

Where the book teaches it

Related terms

Slow and fast pointersSliding window