Selection Sort
Selection sort algorithm sorts an unsorted array by repeatedly finding the minimum element and placing it to the beginning of the array.
arr[] = 23 54 2 52 31

//Find minimum element and swap it to the start of array [0..4]
2 54 23 52 31

//Now from the rest of the unsorted array, find minimum element [1..4]
//and place it to the beginning of array [1..4]
2 23 54 52 31

//Now from the rest of the unsorted array, find minimum element [2..4]
//and place it to the beginning of array [2..4]
2 23 31 54 52

//Now from the rest of the unsorted array, find minimum element [3..4]
//and place it to the beginning of array [3..4]
2 23 31 52 54
Show More

Bubble Sort

Insertion Sort

Merge Sort

Quick Sort ( + Randomized )