I've seen the numerous questions about counting the number of set bits in an insert type of
input, but why is it useful?
For those looking for algorithms about bit counting, look here:
You can regard a string of bits as a set
, with a 1 representing membership of the set for the corresponding element. The bit count therefore gives you the population count
of the set.
Practical applications include compression, cryptography and error-correcting codes. See e.g. wikipedia.org/wiki/Hamming_weight and wikipedia.org/wiki/Hamming_distance.