Correctness vs Efficiency
We often wish to compare different algorithms for the same
problem, in order to select the one best suited to our
requirements.
The main features of interest are:
– Correctness: the algorithm solves the problem for all legal
inputs
– Efficiency: how efficient it is (how much time, memory
storage, or other resources it uses?).
• The same algorithm can be implemented by very different
programs written in different programming languages, by
programmers of different levels of skill, and then run on
different computer platforms under different operating
systems
of loop iterations or the specific nature of the subprogram.
● Each memory access takes exactly one time step. Further,
we have as much memory as we need. The RAM model
takes no notice of whether an item is in cache or on the
disk.