Correlation is a weighted moving average: One signal provides the weighting function. The diagram shows how a single point of the correlation function is calculated:
Correlation requires a lot of calculations. If one signal is of length M and the other is of length N, then we need (N * M) multiplications, to calculate the whole correlation function. Note that really, we want to multiply and then accumulate the result  this is typical of DSP operations and is called a 'multiply/accumulate' operation. It is the reason that DSP processors can do multiplications and additions in parallel.
