Selection Sorting Algorithm

selection sorting algotiyhm #melanee
This photo is taken from [1]

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 [4]:

  • Merge sort

In this story, I want to expand the Selection-Sorting algorithm. This algorithm is the most common algorithm in python built-in functions.

selection sorting algorithm
selection sorting algorithm
This gif is taken from [5]

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 [6].

In the end, you can see the complete source code of the selection-sorting algorithm in the python programming language:

selection sorting algorithm
selection sorting algorithm

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:

Python | Data Science Programmer