Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > search algorithm

Thread Tools

search algorithm

Posts: n/a
Anyone ever do something similar to the following in C++?

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.

For example let's assume the key/mask is 32 bits. If I have the
following in my database:

key: 0xA0A000001
mask: 0xFFFF000F

Should match a key such as 0xA0A00007 (the lookup does not specify a

A search solution that returns more than 1 match is possible....
similar to a partial match for a string.

Anyway... anyone ever do anthing similar and if so what was your

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtered Back Projection Algorithm (FBP Algorithm) Bapaiah Katepalli VHDL 1 06-23-2006 04:50 PM
search within a search within a search - looking for better script times out Abby Lee ASP General 5 08-02-2004 04:01 PM
Article: An Analysis of the Google Search Engine Algorithm Johann Blake ASP .Net 0 01-21-2004 03:21 PM
Key generation algorithm and Cipher algorithm Ahmed Moustafa Java 0 11-15-2003 06:35 AM