Variance of a large sequence

23 Views Asked by At

Given a large sequence of data $X$, what is the fastest method to check if:

1) $Var(X) = 0$

or

2) $Var(X) \neq 0$

Thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

$Var(X)=0$ if and only if all data have the same value. Track min and max of the numbers you have already checked. When min $\ne$ max, you know $Var(X) > 0$.