Wanted -- ambiguous lookup routine.

Gisle Hannemyr gisle at ifi.uio.no
Thu Aug 9 18:28:39 AEST 1990


I am storing a number of strings (composed of several words) in a list
in RAM.  For instance (three strings):

    John Fitzgerald Kennedy
    John Frank Oppenheimer
    Lyndon Bird Johnson

I want to look up a string using an unambiguous abbreviation of the words
in the string.

Ie (given the short list above):
    J F K                   => John Fitzgerald Kennedy
    John Fitzgerald Kennedy => John Fitzgerald Kennedy
    L                       => Lyndon Bird Johnson
    J F                     => (error, ambiguous)
    J F L                   => (error, not found)

Typical applications for such a function would be phone directory, or
a completing unambiguous command parser.

Does anyone have a fast C routine that do the above, or know a
clever algorithm to accomplish it.  My main requirement is speed. 

Please mail your replies if possible.  I do not read these groups
regularly.

- gisle hannemyr  (Norwegian Computing Center)
  EAN:   C=no;PRMD=uninett;O=nr;S=Hannemyr;G=Gisle (X.400 SA format)
         gisle.hannemyr at nr.no                      (RFC-822  format)
  Inet:  gisle at ifi.uio.no
  UUCP:  ...!mcvax!ifi!gisle
------------------------------------------------



More information about the Comp.lang.c mailing list