Skip to content

Glossary: Algorithms Beyond the Basics in JavaScript

Two pointers

Also written: two pointer

A pattern that keeps two indexes into the same array, either starting at both ends and moving inward or moving the same way. On sorted prices it finds a pair for the $30 gift card in O(n) with O(1) memory.

Where the book teaches it

Related terms

Slow and fast pointersSliding window