Skip to content

slow / fast [terminology]

Terminology

Usage

  • Use for pointers moving at different speeds.
  • They strongly signal Floyd's cycle detection or linked-list midpoint discovery.
  • Do not replace them with l and r; they are not directional boundaries.
slow = fast = head

while fast and fast.next:
    slow = slow.next
    fast = fast.next.next