JavaScript is required for this website. Please allow JavaScript and refresh the page.
home Home
sort Sorts
LOGARITHMIC
Quick Sort Merge Sort Heap Sort
QUADRATIC
Bubble Sort Selection Sort Insertion Sort Gnome Sort Shaker Sort Odd Even Sort Pancake Sort
WEIRD
Bitonic Sort Radix Sort Shell Sort Comb Sort Bogo Sort Stooge Sort
CUSTOM
Your Sort
SORT VISUALIZER
Bitonic Sort
Elements: 100
DESCRIPTION

Bitonic Sort is a sorting algorithm based on comparisons. It exploits binary sequences, so it can be applied only on data structures with number of elements equal to a power of 2.

The algorithm is made up of two parts. Initially, the data structure gets converted to a binary sequence, creating groups of ascending and descending elements linked together. Next, the groups get merged with an algorithm similar to Merge Sort until the data structure is sorted.

It can be implemented in numerous variants, iteratively or recursively, with different visualizations. This visualization shows an iterative version.

COMPLEXITY
Average Complexity O(log2 n)
Best Case O(log2 n)
Worst Case O(log2 n)
Space Complexity O(n × log2 n)