Bit Fiddling – 4

Pre-Computing   Pre Computing is a technique normally used to speed up algorithms and by actually computing results of a smaller problem and using interpolation or other techniques to solve a larger problem. You trade-off memory/accuracy for speed here, as you will need to load the pre-computed solutions into memory and/or use interpolation to find…

4

Bit Fiddling – 3

Now that we have seen some trivial and  fast approaches to do bit counting. Lets look into one brilliant parallent counting solution. Parallel  Counting 5.  MIT HAKMEM Count HAKMEM (Hacks Memo) is a legendary collection of neat mathematical and programming hacks contributed mostly by people at MIT and some elsewhere. This source is from the MIT AI…

8

Bit Fiddling – 1

 Bits and Pieces   Over the years, I have come across interesting approaches and problems involving bit manipulations. Over this series, I will post a wide range of related solutions and algorithms.   Counting Number of Set Bits   1.     The Trivial Straightforward approach   In this approach, the number is looped through all its…

4