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
Odd Even Sort
Elements: 100
DESCRIPTION

Odd Even Sort (also known as Brick Sort) is a sorting in-place algorithm based on comparisons. It splits the data structure in pairs made up of elements with even indeces and odd indeces respectively.

It compares adjacent pairs and swaps them if they are in the wrong order with an algorithm similar to Bubble Sort. This procedure continues for every pair, alternating between odd/even and even/odd pairs until the structure is sorted.

This algorithm can get executed on paraller processors, but it's not widely used. It can be performant if the data structure is almost sorted, but it's really slow if there are small elements near the end of the data structure since they will require many iterations to get moved in the right place.

COMPLEXITY
Average Complexity O(n2)
Best Case O(n)
Worst Case O(n2)
Space Complexity O(1)