Selection sort(sorting algorithm in data structure) and its time complexity
The document discusses the selection sort algorithm, a straightforward sorting method that iteratively finds the smallest element in a list and places it in the correct position. It outlines the algorithm's steps, pseudo-code, and time complexity, demonstrating how the sorting process works through examples. Selection sort is employed to reorder a sequence of numbers efficiently.
SORTING Algorithm
In computerscience, a sorting algorithm is an
algorithm that puts elements of a list in a certain
order.
2
3.
SELECTION SORT
Selectionsorting is conceptually the most simplest sorting
algorithm.
This algorithm first finds the smallest element in the array
and exchanges it with the element in the first position, then
find the second smallest element and exchange it with the
element in the second position, and continues in this way
until the entire array is sorted.
Keep doing n-1 times to place all n values in the sorted order.
3