Flowcharts & Processes

Floyd's Fast & Slow Pointer Algorithm

Flowcharts & Algorithms diagram · made in Skemio

Flowchart of Floyd's cycle detection algorithm advancing slow and fast pointers and checking for equality or null terminals.
Flowchart of Floyd's cycle detection algorithm advancing slow and fast pointers and checking for equality or null terminals.

What it shows

  • Tortoise pointer moves 1 step; hare pointer moves 2 steps each tick.
  • Relative distance closes by 1 each step, guaranteeing O(N) convergence.
  • Requires strictly O(1) auxiliary memory compared to O(N) hash sets.

The takeaway

Two pointers moving at different speeds detect closed cycles in linear time without memory allocation.

More flowcharts & algorithms diagrams