Part 2— Data Structures and Algorithms in Plain English | Algorithms

Loveday Perfection
3 min readOct 6, 2021
Image credit to Freepik.com

What do you think an algorithm is? Do think an algorithm is just code be it in Python, JavaScript, Go, or whatever language we choose?

We tend to miss the true definition of an algorithm and here’s something you should know, an algorithm doesn’t necessarily have to be all about code, in fact, the mathematics you have been solving all this while is just as much of an algorithm as anything might be. When you create a thought process to finding a solution to a problem, what you are creating, in itself, can be referred to as an algorithm.

And with this knowledge, we can generalize the definition as follows:

An algorithm is a set of well-defined instructions that solves a particular problem. In most cases, these instructions might require input or a set of inputs to produce the desired output.

A simple example would be the addition of two numbers. The algorithm required for these can be written as a regular text as follows:

  1. Receive an input of two numbers
  2. Use the + operator to add the numbers
  3. Display or return the result as desired

If this addition has any constraints, let’s say the addition can only be performed on non-floating point numbers, then the algorithm above would take in another process and change into the following.

  1. Receive an input of two numbers
  2. Ensure that the inputs are non-floating point numbers
  3. Use the + operator to add the numbers
  4. Display or return the result as desired

Now, we can convert the above into a computer algorithm written in Python as shown below.

A Good Algorithm Has the Following Qualities

  1. Well defined input and output
  2. Clear and well-defined steps
  3. Effective among all possibles ways
  4. Should not be a computer code; rather, one that can be implemented using different computer languages.

Other algorithms are given as snapshots below.

Finding the largest among three numbers

Finding the factorial of a number

Finding the factorial of a number isn’t limited to one process, however, with the above algorithm, any programmer can successfully create a factorial calculator. As stated above, a quality algorithm must not include a computer code; rather, should be a detailed instruction that can be implemented in any computer-understood language.

How else can we write the factorial calculator above? You can send your solutions to me via https://abbrefy.xyz/techmovers

But that’s not all! Here’s another challenge for you. Write an algorithm for calculating the Nth Fibonacci series.

Once you have your algorithm ready, use any programming language of your choice to implement it. As previously stated, you can share your solutions via https://abbrefy.xyz/techmovers

Data Structures And Its Types

Just like you, I’m already eager to see what’s in store. Have I also been getting the definitions wrong? Is my knowledge of arrays and objects as data structures correct? Do strings and booleans also represent a structure for data?

Don’t worry, pile the questions up as the next part of this series will dive into what data structures are, the types, the most commonly used data structures and more.

Did you find today’s Tech Digest enlightening? Then don’t hesitate to clap it out loud! See you in the next one.

--

--

Loveday Perfection

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