Re: data structure for strings
Date: 2000/07/25
Message-ID: <8lkqv1$bcl$1_at_relay1.dsccc.com>#1/1
How about store the 1st 4 characters in a 32 bit int, and use a binary search. Store the other two in a 16 bit int, or 32 bit int.
In article <Pine.LNX.4.10.10007232050070.5828-100000_at_Gloria.CAM.ORG>,
Marc Tardif <intmktg_at_Gloria.CAM.ORG> wrote:
)If I have 130 words of up to 6 characters, in what kind of data structure
)can I store these words for quick string comparison? In other words, if I
)have an unknown word, I need to determine if it is like any of the 130
)words. This data structure does not need to be expandable, the list will
)always be the same 130 words.
)
)I thought of using the Aho-Corasick algorithm for multiple-pattern
)matching, but considering each trie entry takes about 20bytes (tree ptr,
)next, fail, label) and each tree node another 16bytes (trie ptr, left
)node, right node, balance), that ends-up taking far too much memory. Any
)other ideas would be much appreciated.
)
)
-- char *p="char *p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);} This message made from 100% recycled bits. I can explain it for you, but I can't understand it for you. I don't speak for Alcatel <- They make me say that.Received on Tue Jul 25 2000 - 00:00:00 CEST