Mail
Say hi!
YouTube
Subscribe
GitHub
Peek at my code
Instagram
See my stories
Pinterest
Grab some ideas
X
Follow on X
TikTok
Let's make algorithms visual
Facebook
Join the community
LinkedIn
Let’s connect
Home
VisualLab
Blog
Gallery
ToolKit
Toggle menu
Loading...
Visualizations
VISUALLAB
Bubble Sort
Repeatedly swaps adjacent elements if they are in wrong order until the largest values bubble to the end.
Algorithms
Sorting
O(n²)
Cocktail Shaker Sort
Passes through the array in both directions, pushing large values to the end and small values to the start each round.
Algorithms
Sorting
O(n²)
Selection Sort
Repeatedly finds the smallest remaining element and swaps it into the next position until the whole array is sorted.
Sorting
Comparison
In-place
Unstable
O(n²)
Insertion Sort
Takes each element in turn and shifts larger values right until it can drop into its place, like sorting a hand of cards.
Sorting
Comparison
In-place
Stable
O(n²)
Gnome Sort
Walks forward while neighbours are in order and steps back, swapping, whenever they aren't, until it reaches the end.
Sorting
Comparison
In-place
Stable
O(n²)
Comb Sort
Compares and swaps elements a shrinking gap apart, moving far-off values quickly before finishing with neighbours.
Sorting
Comparison
In-place
Unstable
O(n²)
Merge Sort
Splits the array into halves, sorts each half, and merges them back together through an auxiliary array.
Sorting
Comparison
Divide and conquer
Stable
O(n log n)
Linear Search
Checks each value from left to right until it finds the target or reaches the end of the array.
Searching
Sequential
Unsorted input
O(n)
Quick Sort
Picks a pivot, moves smaller values to its left and larger ones to its right, then sorts each side the same way.
Sorting
Comparison
Divide and conquer
In-place
O(n log n)
Sentinel Search
Places the target at the end of the array as a sentinel, so the scan can skip its bounds check and stop only on a match.
Searching
Sequential
Unsorted input
O(n)
Binary Search
Checks the middle of a sorted array and discards the half that can't hold the target until it finds it or runs out of values.
Searching
Divide and conquer
Sorted input
O(log n)
Ternary Search
Checks two points that split a sorted array into thirds and keeps only the third that can still hold the target.
Searching
Divide and conquer
Sorted input
O(log n)
Jump Search
Jumps ahead through a sorted array in fixed-size blocks, then scans the one block that can hold the target.
Searching
Block search
Sorted input
O(√n)
Interpolation Search
Estimates where the target should be from its value, like opening a dictionary near the right letter, and narrows in from there.
Searching
Sorted input
Uniform data
O(log log n)
Exponential Search
Doubles its reach (1, 2, 4, 8, …) through a sorted array until it passes the target, then binary searches the range it skipped.
Searching
Divide and conquer
Sorted input
O(log n)
Fibonacci Search
Splits a sorted array at Fibonacci numbers instead of halves, narrowing the range using only addition and subtraction.
Searching
Divide and conquer
Sorted input
O(log n)
Visualizations | Onjsdev