Algorithm to compute the Variance of the signal?
You want the sample variance:

$$
s^2 = \frac{1}{N-1} \sum_{n=0}^{N-1} (x_n - \mu_x)^2
$$

where the mean, $\mu_x$, is given by

$$
\mu_x = \frac{1}{N} \sum_{n=0}^{N-1} x_n.
$$

The $\frac{1}{N-1}$ factor should be used to account for the bias that is otherwise there if $\frac{1}{N}$ is used. One way to think about this is the sample variance is computed from $N-1$ differences between samples, rather than $N$ samples.