Selection sort explained with simple example
Selection sort is one of the simplest sorting algorithm, which traverse through the list, picks the minimum item from the unsorted list and place it in its place in the final sorted list.
This sorting algorithm contains (n – 1) traversal.
Pros:
1) Simple algorithm and hence efficient for small list of data.
2) No extra memory needed.
3) Good for cases when list is almost sorted (only few misplaced items).
4) Very less number of swap operation(O(n)), as in every pass only 1 swap of data is needed at max.
Cons:
1) Very slow algorithm. Not good for very large set of data.