Re: search algorithm

fenwayfool <peterson.russell@xxxxxxxxx> writes:

On Jan 6, 7:02 pm, Patricia Shanahan <p...@xxxxxxx> wrote:
fenwayfool wrote:
Anyone ever do something similar to the following (in C++ or some
other language)...

I need to create a database that has a fairly long key.  Consider the
key a bitstring.  My problem is that this key also has an associated
mask.  All bits that we "care" about in the key have a mask value of
'1' while the don't care bits are marked with a zero.

Basically I want to simulate the operation of a ternary CAM in
software in a semi efficient manner.  I have a few other databases I
use a hash_map<> for which works just fine... but the introduction of
a "don't care" mask eliminates this as a possibility.

Is the mask fixed for a given item in the database, or subject to change
from search to search?


The mask is fixed for any given database entry... but each entry may
have a different mask.

And what about the queries?

__Pascal Bourguignon__