Algorithms, Data, Automata and Program

Algorithms, Data, and Automata

An algorithm is a well-defined step-by step set of instructions to complete a specific task. Each step in the algorithm can be converted to a program to actually make the algorithm do what it is designed to do.

Data is the information processed by the algorithm and how it is represented.

An automaton is the device that follows the instructions specified by the algorithm.

Let's look at an example. Suppose you want to calculate the total cost of the paint needed to repaint your room. In this case,

data = price of the paint, total surface area of the walls in your room, paint needed per square meter of wall

algorithm = paint needed per square meter * total surface area of the walls (in square meters) * price of the paint

automaton = your brain (or calculator)


The usual intent is that the program can be executed by a computer.

Programs consist of instructions and data which is manipulated by the instructions.

Free Resume Bank

All computers consist of these 4 main components:

Central Processing Unit Memory
Input and Output Devices Storage Devices

The CPU (Central Processing Unit) is responsible for the actual execution of the instructions contained in the programs. During execution these programs and the data they operate on are usually stored in memory. Intermediate results are saved and later read from memory.

Before execution the program is usually stored on a storage device such as a disk, and then read into memory in its entirety just before execution begins. It would not be practical to execute instructions by reading them from disk one-at-a-time because it would be extremely slow and inefficient

During execution, data can also be read from input devices such as keyboards and network interface cards. For example, a program that adds 6 numbers entered by the user would take as input-data 6 numbers from the keyboard.

Results from the execution of an algorithm are either output or stored.

Computer Software

Computer software is the sequence of instructions that is executed by the computer's CPU.

There are several types of computer software, and software can be written in many different programming languages.


There are two broad categories of computer software:

System software

Application software

System software consists of operating systems and translation systems.

Operating systems control and manage the computing resources, such as memory, I/O devices and CPU.

Translation systems are programs that are used to develop software.

Application software consists of programs that solve a particular problem or provide a particular service. It is often the case that many application programs will be running on a computer at the same time.

Application programs are generally written to use a particular operating system. For example, an application written for Windows 95 will not, without modification, be able to run using Linux.

Machine Language

The language that is understood by a computer is determined by the CPU in that computer. Each CPU has a specific set of instructions that it understands.

Basic Concepts

Computers use the binary number system; i.e. use only 0s and 1s.

all numbers, characters, etc. are represented as combinations of 0s and 1s.

arithmetic operations are executed in binary number system.

Bit = a binary digit

Byte = eight bits

Machine language

The category of languages understood by CPUs is called machine language. To see a sample of machine language see the Machine Language Example.

There are two problems with machine language:

Every CPU only understands one type of machine language. It would be nice to have a choice of languages when we go to write some code. Also, this could make it difficult to move programs to a computer with a different CPU.

Machine languages are written using numbers (that's the way CPUs like it). It is very difficult for us to write and understand software that consists only of a sequence of numbers.

Fortunately for us there is a common solution to these problems. We solve these problems by using software that can take a language of our choice and convert it to machine language. This helps us because:

We have a choice of languages no matter what CPU it will be run on.

If we want to move a program to another CPU, we can convert the program to the machine language appropriate to the new CPU.

We can write programs in languages more suited to us than machine language.

Assembly and High-Level Languages

Only programs written in the appropriate machine language can be directly executed by the CPU.

If we want to write a program in a language that is easier to read and write than machine language, we must translate it to machine language before the CPU can execute it.

There are 2 categories of languages that we write programs in. These are:

Assembly language

High-level language

As well, there are also special-purpose languages designed to make certain types of programming easier.

Assembly languages are similar to machine language, except that the instructions (which were represented as numbers in machine language) have simple names. This makes it easier to read and write.

The program that translates assembly-language programs into machine-language programs is called an assembler. Each assembler knows how to translate a particular assembly language into a corresponding machine language.

Assembly language is an improvement because it is easier to read and write and understand. However, a much larger improvement is made by the high-level languages. This category of languages are general-purpose in that they can be used for a wide variety of programming tasks. They can be translated into the machine language for a wide variety of CPUs.

A high-level language program must be translated into machine language before it can be run by the CPU. There are 2 ways to do this:

Compile it, or

Interpret it.

Compiling a program involves using another program (called a compiler) to translate the high-level program (called the source code) into machine language. When compiling a program the whole program is translated once and stored as machine language. This machine-language program (called the executable) can then be executed any number of times.

Interpreting a program also translates it to machine language, but in this case the high-level program is interpreted step by step. What happens is that each instruction of the high-level program is translated then executed in turn. This makes running the program much slower because it is being translated and executed at the same time. Also the translation occurs every time the program is run, not just once ahead of time.

The goal of a software engineer is to produce a software system that is:



cost effective



Back to Programming Section

Subscribe Now! Make Money