Algorithms are one of those critical topics in programming that every programmer must know this concept as an initial knowledge.
In mathematics and computer science, an algorithm is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of specific problems or to perform a computation [2, 3]. On the other hand, the algorithm is a way of solving the program or problem.
There are many types of sorting algorithms in Python :
- Merge sort
- Selection sort
- Bubble sort
- Insertion sort
- Heap sort
- Quick sort
In this story, I want to expand the Selection-Sorting algorithm. This algorithm is the most common algorithm in python built-in functions.
This algorithm segments the list into two parts: sorted and unsorted. We continuously remove the smallest element of the unsorted segment of the list and append it to the sorted segment .
In the end, you can see the complete source code of the selection-sorting algorithm in the python programming language:
The output will be:
Input array : [64, 25, 64, 12, 24, 22, 11]
Sorted array : [11, 12, 22, 24, 25, 64, 64]
If you find this article helpful please share it with your friends. Stay tuned, enjoy programming and contact me: