text
stringlengths
0
8.13M
It is not possible to give a formal definition of the concept of an algorithm but
it can be characterized well enough so that no ambiguity remains as to the
meaning of the term. This remark is true for all the concepts treated in this
section. Perhapscharacterizationisabettertermtouse. Analgorithmconsists
of a set of instructions for carrying out a certain task. In computer science the
task is a computation, a notion that will be defined below. The concept can,
and must be, further elaborated by the following clauses.
The set of instructions should be precise and unambiguous. The number
of instructions should be finite and each instruction should be finite in
length.
A machine or a human can execute it.
There should be no room for subjective decisions, appeal to human intel-
ligence or creative intervention of the user.
It should solve some general problem.
It need not be phrased in any particular language,programming or natu-
ral.
The first three clauses imply that all creative or intelligent effort goes into
the taskoffinding orconstructingthe algorithm. Oncethe algorithmis known,
it should be possible to carry it out automatically or mechanically. The fourth
clausehastodowiththe factthatwe arenotingeneralinterestedinparticular
14
cases, rather we want so solve sets of problems, often parameterized by a col-
lection of variables. Therefore a general algorithm has a domain of definition,
which is the set of meaningful, or allowed, input values or instances. The last
pointmeansthatalgorithmshaveanabstractexistenceindependentofanypar-
ticular language. In practice, an exact programming language or pseudo-code
languageisusefulinordertosatisfythefirstthreeclauses. Thetermmechanical
methodoreffective methodcanbeconsideredtobesynonymouswithalgorithm.
The wordprocedure, can be used instead of method. Sometimes, the word gen-
eral will be used to emphasize that we are considering methods applicable to a
range or set of problems.
The computational models of the thirties identified this informal notion of
an algorithm with precisely defined formal models of computation.
Note that we do not include termination among the characteristics of algo-
rithms. That would be inappropriate for two different reasons. Firstly, many
algorithmsarenotmeanttoterminate,atleastnotbeforeweactivelychooseto
terminate them. Examples are operating systems, web servers and lots of ev-
eryday applications like word processors. Secondly, termination is a non-trivial
issue that has to do with executing, or running, the algorithm. This will be
discussed in the next section.
2.1.2 Computation
By a computation we mean the actual carrying out of an algorithm. From this
followsthatcomputationsareprocessestakingplaceintime,thatcanbecarried
out by either machine, human or any other suitable physical system. The only
requirement is that the computing system ’understands’ the language used to
write the algorithm in, and thus is able to carry out the instructions.
This distinction between an algorithm as a passive description of a compu-
tation and a computation as an actual enacting of an algorithm is not always
upheld. The terms are often used interchangeably. In practicalworkwith com-
puters this does not lead to any confusion but when discussing fundamental
questions of principle it is helpful to maintain this distinction.
When it comes to quantum computation and quantum algorithms the dis-
tinction is somewhat more acute. At the present time there are no quantum
computers,sothereisnothingtorunthequantumalgorithmson. Furthermore,
itis notpracticalto simulate quantumcomputations onclassicalcomputers,as
thetimeevolutionofaquantummechanicalsystemthatisinherentinquantum
computation requires exponential resources!
Iftheabovecharacterizationofanalgorithmisappliedtoahumanperform-
ing a computation, the question can be asked as to what are the limitations
of algorithms or computation. What can be calculated effectively, or mechani-
cally,ispreciselywhatcanbedonebyfollowinganalgorithmwiththeadditional
clause that the algorithm should always produce the desired result in a finite
numberofsteps. This question,whetherthe algorithmterminatesornot,turns
out to be a nontrivial issue as already noted.
15
2.1.3 Program
A program is an algorithm written in a certain language. The term program is
used in two slightly different, but related senses.
Inthe firstsense,wearereferringto aprogramwritteninageneralpurpose
programminglanguage. Suchaprogramshouldbepossibletorunontheappro-
priate computing machine without further work, except possible compilation.
Hence the program must contain all circumstantial information like include or
import statements for supporting files and software. The program furthermore
should handle input and output of data, either in an interactive way through
standard input and output devices or via a file system. A programis therefore
a practical embodiment of an abstract algorithm.
Inthesecondsense,the termprogramisusedforacollectionofinstructions
foracomputationinanabstractcomputationalmodellikeTuringmachines. In
this case, there need not be a physical machine to carry out the computation.
But it should be possibly to carry it out (by a human) by adhering to the rules
and specifications of the computational model.
In some cases the instructions might be ordered in a list. In that case, we
consider the execution order to be given by the ordering of the instructions in
the list, possibly with branching of to labels in the list.4
When the programis actually a set of instructions, no execution orderingis
presupposed. Themachinelooksuptheproperinstructiontoexecutedepending
on the state of the machine and the data. This is the way a Turing machine
computes.
2.1.4 Process
By a process we mean a program in execution. In some contexts, notably
operatingsystems,the wordprocessisreservedforexecutingprogramsthatare
not meant to terminate. In the present context we are primarily interested in
terminatingprocessesandI willusethe terminbothsenses,letting thecontext
determine which meaning is referred to.
Thus computation and process emphasizes the physical and dynamical side