Selection sort is one of the most simple sorting algorithm. This sorting algorithm is an in-place comparison-based algorithm in which the list or the array used is divided into two parts, the left part is the sorted part of the list and the right part consists of unsorted element of the array. Initially, the sorted part is empty and the unsorted part is the entire list.
In Selection sort in each iteration the smallest element in the unsorted part of the array is brought to the to its correct position.Selection almost always outperforms bubble sort and gnome sort.
This algorithm is not suitable for large data sets as its average and worst case complexities are of Ο(n2), where n is the number of items.
See the following example for better understanding.
To know more about selection sort click Here.
C Program
C++ Program
Sample input and output to check the program
You might also be interested in
Bubble sort Algorithm
Insertion sort Algorithm
Hashing with Quadratic Probing
Hashing with Linear Probing
Find Trailing number of zeros in factorial of a number.
Check if a number is a Fibonacci number or not
Find Factorial of a number
Comments
Post a Comment