Vismo · Create · Explore · Topics · Guides · Pricing

Binary Search Step by Step

This animation walks through binary search on a sorted array, highlighting the low, mid, and high indices as the middle element is compared to a target value and half the search space is discarded each round. A complete worked example shows index tracking and comparisons until the target is located. The video closes by deriving why the process runs in O(log n) time, contrasting it with linear search's O(n) behavior. Useful for second-year CSE students studying algorithm design and complexity analysis.

Narrated · 16:9 · Preview before teaching · automatic layout checks do not establish subject accuracy

The prompt that made it

Explain binary search to a second-year Computer Science and Engineering student. Start with a sorted array and a target value. Visually show the middle element being selected, compare it with the target, eliminate the half that cannot contain the target, and repeat until the target is found. Include one complete worked example with clear array values, indices, comparisons, and the final result. Use simple visual animations and concise narration. End with the time complexity O(log n) and explain why binary search is faster than linear search for a sorted array. Audience: Second year {computer science and Engineering}

Make your own version

Make the next one in this series

Related animations

How A Perceptron Makes A Decision
How A Perceptron Makes A Decision

This animation visualizes a single perceptron processing weighted inputs, summing them with a bias, and passin…

From logic gates to arithmetic: the half adder
From logic gates to arithmetic: the half adder

This animation shows how a half adder circuit uses an XOR gate to compute the sum bit and an AND gate to compu…

Minimum spanning tree with Kruskal's algorithm
Minimum spanning tree with Kruskal's algorithm

A weighted graph is processed by sorting all edges from cheapest to most expensive, adding each one only if it…

Fibonacci: the recursion tree repeats work; memoisation removes it
Fibonacci: the recursion tree repeats work; memoisation removes it

This animation draws the full recursion tree for fib(5), showing all 15 calls and highlighting the repeated su…

Recursion on the call stack: 5! unwinds
Recursion on the call stack: 5! unwinds

This animation visualizes fact(5) as it pushes five stacked frames, one for each recursive call, until reachin…

Binary search tree: smaller left, larger right
Binary search tree: smaller left, larger right

Values 50, 30, 70, 20, 40, 60, 80, and 35 are inserted one at a time into a binary search tree, with each comp…