Selection Sorting Algorithm

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.

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:

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:




Data scientist in pharmaceutical, medical industries | Chemist

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Terra Virtua and Matic Network Announce Partnership As They Take Digital Collecting To The…

Elements and Data Type in Python

Adding authentication to Kubernetes app using Keycloak and the new oauth2-proxy

How to generate, play and solve Sudoku puzzles in R

How to Create a Simple Web Application Using Python’s Django Framework


How to win in the largest hackathon in Europe

Want to Ship Code Faster? Minimize Partially Done Work

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Data scientist in pharmaceutical, medical industries | Chemist

More from Medium

IBM Brazil's Marathon Behind the Code 2021

Tuple vs List: Difference Between List and Tuple in Python

Understanding Trees in the world of Computer Science

Machine Learning — Researchers from the field