Tools and techniques for algorithm design

What are algorithms, why are they so important in programming. What parts do all algorithms generally have, and what kinds of tools are there to formally specify them, before you start programming.

One of the most important challenges in programming is the algorithm designunderstanding this task as the analysis and detail of the steps that an algorithm would have, with their corresponding variants. Making an algorithm directly with code in a programming language can be a complex task, especially when we are starting out in the world of programming, so there are various tools and previous steps that we can take to make our lives easier.

What is an algorithm

Of course, before talking about the possible tools for designing algorithms, it is convenient to describe what an algorithm is.

An algorithm is a sequence of actions that must be done to solve a task. It is not something that we find only in programming, but it is a concept belonging to real life. For example, when they tell us in a cooking recipe what we must do to be able to do it, they are giving us an algorithm.

Algorithms are very important in programming since computers by themselves are not capable of understanding anything. Let’s see this with an example: if in a recipe they tell us “cook over medium heat for 30 minutes“, we can know that it actually refers to several steps:

  • Put the casserole on the kitchen fire hydrant
  • Light the fire hydrant (which itself could be broken down into several actions)
  • Set the temperature to half (and we can tell if our kitchen is very powerful, in which case we may set it to less than half… or vice versa)
  • Wait 30 minutes and during that time, even if they haven’t told us anything, we’ll keep an eye on the casserole in case it runs out of water or the food sticks.
See also  Photoshop Pen Tool

Of course, a cook can understand all this thanks to his own experience, however, the computer will not be able to understand or do anything that we have not indicated. That is why we have to be so accurate when specifying an algorithmand not leave a single step for understood.

Characteristics of an algorithm

An algorithm is the abstract description of all actions that a computer must perform, which leads us to the problem solution.

Must be concise and detailedas well as finitebut above all it has to be clear and as simple as possible.

Difficulty in designing algorithms

Many times, making an algorithm can be quite simple. For example, adding a sequence of numbers should not present any problem. However, there are times when the needs of an algorithm can cause its programming to get out of hand.

Examples of algorithms that can be complex is ordering a sequence of numbers, traversing a tree-type data structure, or a graph. These are typical programming examples seen in schools and that it would not be bad for you to practice at some point. But apart from the “book” examples, in real life there can also be complex algorithms, when procedures involving many steps have to be carried out, which can also branch into many variants.

When an algorithm gets complicated, and especially when we are learning to program, it is possible to use a series of tools and techniques that we are going to explain throughout this .

In practice, when we are programming applications we rarely use some of these tools, due to several factors: 1) There are libraries with code to do difficult things, like ordering data structures with different criteria or traversing them. 2) Our codes must be very simple, so most of the time we break down the problems into different modules, so that each one of them is easier than the previous ones. 3) Because the years of experience offer us a base on which we do not have so many problems to specify the steps to carry out the tasks.

See also  Development-oriented web servers

Structures of a program

Before seeing the useful tools for designing algorithms, it is interesting to stop to analyze the structure of most computer programs.

A program will be divided into 3 clearly differentiated parts:

  • Performing data entry
  • Process of manipulation or transformation of that data
  • output processes

Every program is made up of a set of instructions capable of managing a set of data.

Tools and techniques for algorithm design

For the design of algorithms, a pencil and paper is often the most appropriate. Expressing things in advance, without code, before you start programming is useful for clarify the ideas and have a work schedule. Analyzing this problem in our own way, with our common sense, and with totally arbitrary diagrams can be a good option.

However, when learning programming, they tell us how we can make these diagrams in a standard way, so that we all use the same notation and we can make each other understand.

In this case, the type of diagram that is most often used to specify an algorithm is the Flowchart.

Flowcharts

Flowcharts are graphic representations that, through the use of symbols linked by flow lines, show the logical sequence that must be followed to solve the problem.

Flowcharts should be programming language independent employee, must be flexible and simple.

On the other hand, they have to be normalized with some standard such as ISO (worldwide), ANSI (American level) or IEEE (European level).

There are 3 types of flowcharts:

  • organizational charts: Simple graphical representation with the elements that represent the data inputs and outputs of the program
  • ordinogram: Graphical representation with logical and detailed sequences of all the steps to follow to solve the algorithm.
  • pseudocode: Intermediate language between the natural and the programming that represents the solution of the algorithm by means of the word.
See also  General characteristics of Google Maps and Yahoo Maps

Among these three, the most used are flowcharts or pseudocodes, since they are the ones that help programmers the most when transferring these algorithms to different programming languages.

In the following articles we will delve deeper into each one of them and we will learn to build and read them, for their subsequent passage to the required programming language. You can continue reading in the article dedicated to .

Loading Facebook Comments ...
Loading Disqus Comments ...