List Intersection Visualizer

Visualize the two-pointer technique for finding the intersection of two sorted lists.

List 1:

1
2
4
5
6
8
10

List 2:

2
3
4
6
9
10
12

Intersection: []

How It Works:

  1. 1. Use two pointers, one for each sorted list
  2. 2. Compare elements at current positions
  3. 3. If equal, add to intersection and advance both pointers
  4. 4. If first element is smaller, advance first pointer
  5. 5. If second element is smaller, advance second pointer
  6. 6. Continue until one list is exhausted

Legend:

Unprocessed
Current Position
Found in Intersection

Digital Agency footer logo

STAY INFORMED

Sign up to receive exclusive updates and previews.

SITE MAP