SproutStackSproutStack home

Two Pointers (visual)

Sorted array? Converge from both ends.

Teaching this in the lesson? Read the chapter.

Step 1 of 3

1. l=0, r=n-1

Two fingers on the array.

  1. [1 2 7 11]l at 0, r at 3

Prefer prose? Every animation has a matching chapter, listed above. Diagrams use text labels, so they read aloud with the listen button on the lesson page.