Part 9 — Data Structures and Algorithms in Plain English | Sorting Algorithms

Loveday Perfection
2 min readFeb 17, 2022

--

Have you ever tried to arrange data in a specific order — ascending or descending? No need to think that long about it, you have…and if you happened to be a developer then you, most definitely, have also done it programmatically. This may have been a simple operation you performed on primitives like Strings or objects like Arrays.

Irrespective of the programming language you may have used, it is quite universal that sorting requires that a sort() function be invoked. And on invocation, the array or string gets sorted in the order you’ve specified, just like magic!

Yea, magic is cool, but how would you like to be able to recreate this magic? It’s an essential part of being a tech person to understand how some of your tech tools work. And as a software engineer, it’s necessary that you understand how the sort() function works.

First, a sort() function makes use of a sorting algorithm and by definition,

A sorting algorithm is a computer program used to arrange elements of an array or list in a specific order.

And like any other solution to a problem, there’s always much more than just one. We have several sorting algorithms and they include:

  • Bubble Sort
  • Selection Sort
  • Insertion Sort
  • Merge Sort
  • Quicksort
  • Counting Sort
  • Radix Sort
  • Bucket Sort
  • Heap Sort
  • Shell Sort

Why do we have a lot of them? Which one do we use? How do we go about writing their algorithms? Should I know the algorithm for every one of these sorting algorithms?

Note that you don’t have to know all, however, it’s essential that you know a few (maybe 3). Don’t worry, we will be breaking down some of this algorithms in plain English in coming weeks. For now, know that we have several of these sorting algorithms and they vary in efficiency. Knowing which algorithm to use depends on the efficiency you need.

Below is a table of the Time and Space Complexity of these sorting algorithms.

And we’ve come to the end of this article. Up next will be a look into Bubble Sort and its algorithm.

If you are spooked to see the next article, then be sure to clap this one up and comment if you’ve got questions. And if you need to reach me, you can do so via https://samperfect.me

Stay safe and see you in the next ✌.

--

--

Loveday Perfection

herbalist 🌿 — busy doing juju @opensaucerers @paytagafrica @cholatrek_tech @gdg_akure — 📩 wizard@opensaucerer.com