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

Selection Sort is an iterative and in-place sorting algorithm that divides the data structure in two sublists: the ordered one, and the unordered one. The algorithm loops for all the elements of the data structure and for every cycle picks the smallest element of the unordered sublist and adds it to the sorted sublist, progressively filling it.

It's a really simple and intuitive algorithm that does not require additional memory, but it's not really efficient on big data structures due to its quadratic time complexity.

This algorithm has been upgraded and enhanced in several variants such as Heap Sort.

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