AiTechWorlds
AiTechWorlds
Visualize Jump Search stepping in √n blocks then scanning, with synced code and step explanations.
import math
def jump_search(a, target):
n = len(a); step = int(math.sqrt(n)); prev = 0
while a[min(step, n) - 1] < target:
prev = step; step += int(math.sqrt(n))
if prev >= n: return -1
for i in range(prev, min(step, n)):
if a[i] == target: return i
return -1Jump Search steps ahead by fixed blocks of size √n on a sorted array, then does a linear scan inside the block where the target must lie.
| Best | O(1) |
| Average | O(√n) |
| Worst | O(√n) |
| Space | O(1) |
| Requires sorted | Yes |
The Jump Search Visualizer animates how Jump Search works: on a sorted array it jumps ahead in fixed blocks of size √n until it passes the target, then performs a linear scan within that block. Jump Search runs in O(√n) time, uses O(1) space, and requires a sorted array.
Set a target
Type the value to search for, or click New Array to randomize the sorted data and target.
Play the animation
Press Play to watch √n block jumps, then the linear scan inside the block.
Step and scrub
Use Step Forward/Back or the timeline to study each jump.
Read the synced code
The highlighted pseudocode line tracks the jump and scan; switch tabs for C++, Java, Python, or JavaScript.
100% Private — No Server Required
All processing happens directly in your browser. No data is uploaded, stored, or transmitted to any server.
Last reviewed on June 14, 2026 by the AiTechWorlds Tools Team. All processing runs locally in your browser.