
Chapter 3
Algorithms and
Complexity
3.1 Introduction
An algorithm is a sequence of instructions that provides a solution to a given problem.
In general, an algorithm works on an input and provides an output by applying the
instructions on this input. Clearly, a fundamental requirement for any algorithm is
that it should work correctly. Also, we would be interested to know the time needed
to solve the problem, which is expressed as the number of steps for the algorithm to
terminate. Another point of interest for the algorithm designer and the implementor is
whether any other algorithm with better performance, that is, with fewer steps exists.
An express ...