By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 839 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Heterogeneous linked structures; for a Tire search.

P: n/a
Could someone offer some insight on this:

I have started implementing a Trie, somewhere along the lines of the Aho
Corasick algorithm (but somewhat different).

The structures I would like to have are these:

class TrieNode {};

class TrieVector : public TrieNode
{
TrieNode *vector[256]; // A 256 way table, for input transitions on a
byte.
};

class TrieSequence ; public TrieNode
{
unsigned short *pattern;
size_t patern_len;
TireNode *match;
};
Now what I want to be able to do is have the vector array 'elements' either
to point to another TrieVector, or a TrieSequence.Depending on the data I
put in it. Likewise, match will point to a TrieVector or a TrieSequence.

Now I don't see a good way of doing this. There seems to be two main ways
(without changing the structures)

using typeid() and comparing each node in the structure, or using
dynamic_cast. What is a good approach for this sort of thing?

--
GPGKID: 0x7520A898
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.