Follow

Subscribe

Follow

Subscribe

Algorithm: what is it?

Do you know what an algorithm is? In this article you will learn in a way never seen before in free content! And we also offer exercises!

If you read a technical programming book you will certainly have a very complicated definition of the meaning of the word algorithm.

Not just something like “a finite sequence of commands”, but also “a logical sequence of procedures” or things like that.

In fact, algorithm is a mathematical concept that is a little difficult to understand if you go that way! But I will not let you go that way!

First, put one thing in your head: an algorithm is a set of steps used to solve problems in an organized way. The rest comes with practice!

The 3-step model

For computing, and especially for you who are a beginner and want to learn programming, the concept of algorithm can be perfectly understood with a much simpler, visual and didactic explanation.

First, imagine a model consisting of 3 steps: 1) Input, 2) Processing and 3) Output.

3-step model

The input is the step that obtains the information for the algorithm, that is, the information that it will process.

Processing is the step where the algorithm will do its job, that is, do what it was created to do.

The output is the step where he will show the result of the processing, that is, show what was done by your work.

So, with this 3-step model in mind, we can create algorithms to solve common real-life problems.

Algorithm for arithmetic mean

Just for example, imagine that we are going to create an algorithm to calculate an arithmetic mean. So, let’s use our 3-step model:

  • The input represents the set of numbers whose average will be calculated.
  • Processing represents the calculation of the arithmetic mean.
  • The output represents the calculated average.

Now for the real application:

Algorithm to make a cake

Now, for example, imagine an algorithm to make a cake. As in the previous example, we will use the same 3-step process:

Now for the real application:

See how easy it is?

A more in-depth example

Since you already understand the basics of what an algorithm is, let’s look at a more complete model, which divides processing into several other steps.

Undoubtedly, this increase in process steps allows you to be more specific when you need to describe the work done by the algorithm.

Just to illustrate, see how it would be preparing the cake in this more complete model.

In summary, the more detailed model allows you to see more clearly what the algorithm does.

And in the programming? How it works?

In computer programming, we use programming languages in order to create algorithms.

In summary, we use languages to write commands that explain to the computer step by step, what it should do.

  • We explain which and how the inputs will be obtained.
  • How it should process these inputs.
  • And how it should display the output generated by the program.

Exercise

Now that you are able to visualize the meaning of an algorithm, you are certainly ready to solve the exercise below.

Below are the activities of an algorithm to change a lamp. Drag the activities to their respective stages.

Continue your learning and enter the world of computer programming. Read our article about input/output commands, your kick-off to learn how to program.

Was this article helpful to you?

So support us and share it with others who are interested in this subject!

WhatsApp
Facebook
Twitter
LinkedIn
Email

Other articles

Subscribe

This website uses cookies to ensure you get the best experience on our website.