Count the number of one bits in n & (n >> 1). Algorithms to count the one-bits in an integer appear here frequently, and also are well known.
Dave On Jul 22, 2:09 pm, vijay <[email protected]> wrote: > Get the number of pairs of “ones” in a given integer. Eg: if the > integer is 7 (binary: 0111), then the number of pairs of ones is 2 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
