Selection Sorting

With a selection sort, we find the lowest unsorted element, and move it to the end of the sorted list.

3 1 2 4 5 6 5 1 3 6 4 2 3 1 2 5 6 4 3 1 2 4 5 6 Pass 1 Pass 2 Pass 3 Pass 4 5 3 1 6 4 2 Start 3 1 2 4 5 6 Pass 5 3 1 2 4 5 6 Pass 6 Done

There are many tweaks that can improve performance of selection sort, But fundamentally selection sorting is an O(N2) sort.
This is because finding the lowest element is an O(N) problem, and you need to repeat that N times. I.e. find the lowest element in an unsorted list (order N), and do that N times (order N * N)


^ UP ^    < Back <    > Next >