Glossary: Algorithms Beyond the Basics in Java
two pointers
Also written: two-pointer
Two indexes moving through one array, from both ends or in the same direction. On a sorted array they find a pair in O(n) with no extra memory.
Glossary: Algorithms Beyond the Basics in Java
Also written: two-pointer
Two indexes moving through one array, from both ends or in the same direction. On a sorted array they find a pair in O(n) with no extra memory.