Jump Search, explained step by step

Jump Search checks every √n-th element of a sorted array to find the block that could contain the target, then scans that block linearly.

Intuition: Skim a book a chapter at a time, then read page by page once you overshoot.

How it works

  1. Pick a block size of √n.
  2. Jump block by block until a block end is ≥ target.
  3. Linearly scan inside that block.

Complexity

  • Best: O(1)
  • Average: O(√n)
  • Worst: O(√n)
  • Space: O(1)
  • Stable: no

When to use it

Sorted data where jumping backwards is expensive (e.g. linked storage or tape-like media).

Interview questions

  • Why is √n the optimal jump size?
  • When would you choose Jump Search over Binary Search?

Compare Jump Search

Open Jump Search in the visualiser