← all animations

SEARCHING: LINEAR vs BINARY

Linear search works on any array — sorted or not. Binary search needs a sorted array to halve the range. Both rows below hold the same values, just in different orders, and search for the same target.