A computable set of steps to achieve a desired result. An algorithm is set
of steps for completing some task. For example, one could develop an
algorithm for making a peanut butter and jelly sandwich: 1) Walk to the
cupboard and get bread; 2) Take out two pieces of bread from the package;
3) Get a knife and peanut butter and jelly; 4) Using the knife, put jelly
onto one piece of bread; etc. Algorithms are often implemented in computer
science in the form of functions.
A metric is a method for measuring something. Time in seconds might be a
metric used to measure the speed of a runner. Length in feet might be a
metric used to measure the strength of a javelin thrower. Abstract time
is the metric used to measure complexity of an algorithm.
Different computers (or platforms) can yield widely varying results when
running the same implementation of an algorithm. Computers can have
different amounts of memory, different chip designs and clock speeds,
different operating systems, etc., all factors which contribute to the
time it takes to run an algorithm.
Different implementations of the same algorithm can yield widely varying
results in terms of how well they work and run. Timing results depend on
the language used to write the algorithm, the compiler used to compile it,
what data structures and methods the programmer used in coding the
algorithm, etc. This is one reason real running time should not be used
to measure the efficiency of an algorithm; there are too many variables.
The efficiency of an algorithm is the amount of resources used to find an
answer. It is usually measured in terms of the abstract computations,
such as comparisons or data moves, the memory used, the number of messages
passed, the number of disk accesses, etc.
Big-O notation is a theoretical measure of the execution of an algorithm,
usually the time or memory needed, given the problem size n, which is
usually the number of items in the input. Informally, saying some equation
f (n) = O(g(n)) means it is less than some constant multiple of g(n).
More formally, it means there are positive constants c and k, such
that 0 < = f (n) < = c*g(n) for all n > = k. The values of c and k
must be fixed for the function f and must not depend on n.
In computer science, the cost of an algorithm, or how much computing power
and time it takes to run, is a central concern.
Abstract time is a count of the number of abstract steps performed in
the execution of an algorithm, or a count of the significant operations
performed, such as comparisons, multiplications, copies, etc.
Real Running Time
The real running time of an algorithm is the time it takes in some real
unit of measurement, such as seconds, for the algorithm to run.
When determining how complex an algorithm is, or how efficiently it runs,
we only care about it in abstract terms when the input size gets fairly
large. As such, if we have an equation to measure the efficiency of an
algorithm, we only really care about the biggest terms in the equation.
In other words, we only care about the term with the largest order of
magnitude. If we reduce the equation to the biggest term, we end up with
a function representing the "asymptotic bound" of the equation. This kind
of analysis is known as asymptotic analysis.
In terms of abstract time, constant times means a constant number of