Selection Sorting Algorithm

Melanee Group
2 min readAug 18, 2021
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
  • 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.

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

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 follow our Medium account and share this page with your friends to improve the SEO of our article.

References:

[1]. https://www.faceprep.in/algorithms/selection-sort/

[2]. https://en.wikipedia.org/wiki/Computer_science

[3]. https://en.wikipedia.org/wiki/Algorithm

[4]. https://www.interviewbit.com/tutorial/sorting-algorithms/

[5]. https://en.wikipedia.org/wiki/Selection_sort

[6]. https://stackabuse.com/sorting-algorithms-in-python/

If you find this article helpful please share it with your friends. Stay tuned, enjoy programming and contact me:

Writer: Melanee

Contact Melanee: https://github.com/Melanee-Melanee

--

--