This algorithm can easily be adapted to compute the variance of a finite population: simply divide by n instead of n − 1 on the last line.
thiS aLgoritHM cAn Easily Be adaPted to CoMpUTE The VAriAnCE oF A fiNitE poPuLatIon: sImpLy diViDe By n inSTeAd Of n − 1 On THe Last LIne.