Sorting Algorithm2
Sorting Algorithm2
Algorithm:
Step1: Compare each pair of adjacent elements in the list
Step2: Swap two element if necessary
Step3: Repeat this process for all the elements until the entire array is
sorted
Selection Sort
The selection sort algorithm sorts an array by repeatedly finding the
minimum element (considering ascending order) from unsorted part
and putting it at the beginning.
Algorithm:
Step1: Find the minimum value in the list
Step2: Swap it with the value in the current position
Step3: Repeat this process for all the elements until the entire array is
sorted
Insertion Sort
Insertion sort is a simple sorting algorithm that works the way we sort
playing cards in our hands.
Algorithm:
Step1: Compare each pair of adjacent elements in the list
Step2: Insert element into the sorted list, until it occupies correct position.
Step3: Swap two element if necessary
Step4: Repeat this process for all the elements until the entire array is
sorted