When we explicitly write down the rules (or instructions) for solving a given computing problem, we call it an algorithm. Thus algorithms are primarily vehicles for communication; for specifying solutions to computational problems, unambiguously, so that others (or even computers) can understand the solutions. When an algorithm is written according to a particular syntax of a language which can be interpreted by a digital computer, we call it a program. This last step is necessary when we wish to carry out our computations using a computer.
While writing down algorithms, it is important to choose an underlying model of computation, i.e., to choose appropriate primitives to describe an algorithm. This choice determines the kind of computations that can be carried out in the model. For example, if our computational model consists of only ruler and compass constructions, then we can write down explicit rules (algorithms) for bisecting a line segment, bisecting an angle, constructing lengths equal to given irrational numbers and a plethora of other things. We cannot, however, trisect an angle. For trisecting an angle, we require additional primitives like, for example, a protractor. For arithmetic computations we can use various computing models like calculators, slide rules or even an abacus (as we believe our ancestors have been using). With each of these models of computing, the rules for specifying a solution (algorithms) are different, and the precision of the solution also differs. Thus, in our study of algorithms and programs, it becomes important to first choose a reasonable model of computation. Soon in these notes we will describe our choice of computational models which are widely used in modern computing using digital computers.
Once a computational model is available, and we can specify an algorithm (or a program) to solve a given problem, we have to ensure that the algorithm is correct. We would also wish that our algorithms are efficient. Correctness and efficiency of algorithm design are central issues in this course. In what follows, we will endeavour to develop methodologies for the design of correct algorithms.
Thus, the major vehicles for problem solving using computers are:
In the two subsequent chapters we will establish two widely used models of computation and develop methodologies for algorithm design and proving correctness of algorithms in these models. The two models that we will introduce are the functional and the imperative models of computation. We will use the programming languages ML and Java to write programs in these two models respectively. We will devote the remaining part of this chapter to discuss some mathematical preliminaries necessary for programming.