Ways to count the number of 1's in an unsigned integer
I was just working on some cryptography program while crossing some really interesting algorithms to count the number of 1's in an unsigned integer on the web (some of them are O(1)!). Great time to expand your mathematics! Here is a link to the article:
http://www-db.stanford.edu/~manku/bitcount/bitcount.html
Not all of the algorithms are straightforward to understand, so feel free to post a comment to tell the algorithm you like or discuss about any of them!

0 Comments:
Post a Comment
<< Home