Re: data structure for strings

From: Simon Richter <geier_at_phobos.fs.tum.de>
Date: 2000/08/12
Message-ID: <Pine.LNX.4.21.0008120634470.2397-100000_at_phobos.fachschaften.tu-muenchen.de>#1/1


On Sun, 23 Jul 2000, Marc Tardif 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.

What about a binary search? You need 7.022 steps per search, which means comparing a maximum of 14 (8 steps + 6 chars/word) bytes.

   Simon

-- 
PGP public key available from http://phobos.fs.tum.de/pgp/Simon.Richter.asc
 Fingerprint: 10 62 F6 F5 C0 5D 9E D8  47 05 1B 8A 22 E5 4E C1
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
Received on Sat Aug 12 2000 - 00:00:00 CEST

Original text of this message