Link Search Close Search Menu Expand Document

Selection Sort

Selection Sort is an in-place, comparison based sorting.
It virtually partitions the array into sorted and unsorted set.
At each iteration, it takes the minimum element from unsorted partition and places it in the right location within sorted partition.
This operation is repeated until no element is left in unsorted partition.
It has best, average and worst case complexity of O($n^2$). Thus not very well suited for large arrays.

Visualization of Selection Sort

Implementation of Selection Sort





Back to top

Copyright © 2020-2021 Gajanan Bhat. All rights reserved.