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…

## 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…

## Bit Fiddling – 2

In the previous post we dicussed about some trivial straightforward ways of counting set bits. Here we will discuss some fast ways of doing this. 4. Pre-Computing Bits: The fastest ways to solve this problem is through look-up tables. But, like everything else, it comes with a cost. Here, you pay for memory….

## 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…

## Digital Imaging Basics

Color Spaces The human eye is often able to detect many more colors than digital devices can reproduce. For instance, if you look at a blank, white page of paper, your eye is probably detecting at least 100 distinct shades of white. A white wall can easily have 1500 shades of white. High-quality digital cameras,…