Selection Sort Visualizer — Animated, Step-by-Step
Animated selection sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs in your browser.
Code examples
Ready-to-copy reference implementations. Free to use in your own projects and assignments.
How to use
- 1 Press Play to watch each pass scan for the minimum and swap it into place.
- 2 Use Step to advance one comparison at a time as the minimum is tracked.
- 3 Type your own numbers into Custom input and press Apply.
- 4 Follow the highlighted pseudocode and the live comparison / swap counters.
Why use this tool
- See how each pass selects the smallest remaining value and places it at the front.
- Notice it always does the same number of comparisons regardless of input order.
- Metrics show why it makes at most n−1 swaps — useful when writes are expensive.
- Runs entirely in your browser. No signup, no uploads.
Frequently asked questions
What is selection sort?
Selection sort divides the array into a sorted and an unsorted part. Each pass scans the unsorted part for the minimum and swaps it to the boundary.
What is the time complexity of selection sort?
O(n²) in all cases — best, average, and worst — because the scan for the minimum always examines every remaining element.
Is selection sort stable?
No. The long-distance swap of the minimum can move an equal element past another, changing relative order. A linked-list variant can be made stable.
When is selection sort useful?
When the number of writes must be minimized — it performs at most n−1 swaps, far fewer than bubble sort. Otherwise insertion sort is usually preferred.
What is Selection Sort Visualizer?
A Selection Sort Visualizer animates how selection sort repeatedly finds the minimum of the unsorted region and swaps it to the boundary. It shows why the algorithm always performs O(n²) comparisons but at most n−1 swaps.
Selection Sort Visualizer is a free algorithm utility by Zerethon Tools. Animated selection sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs in your browser. Runs entirely in the browser — no signup, no upload.
- Category
- Algorithm
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
Privacy
Your data never leaves your browser unless explicitly stated. Selection Sort Visualizer runs entirely client-side — no server upload, no logging, no tracking of your input.
Related tools
Bubble Sort Visualizer
Animated bubble sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs entirely in your browser.
Open toolInsertion Sort Visualizer
Animated insertion sort with step controls, speed, custom input, live comparison/write counters and pseudocode. Runs in your browser.
Open toolMerge Sort Visualizer
Animated merge sort with step controls, speed, custom input, live comparison/write counters and pseudocode. Runs in your browser.
Open toolQuick Sort Visualizer
Animated quicksort with pivot/partition highlights, step controls, speed, custom input, live counters and pseudocode. Runs in your browser.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.