Xref: utzoo comp.lang.c:30970 comp.sources.wanted:12813 Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!nuug!ifi!gisle From: gisle@ifi.uio.no (Gisle Hannemyr) Newsgroups: comp.lang.c,comp.sources.wanted Subject: Wanted -- ambiguous lookup routine. Message-ID: <1990Aug9.082839.3663@ifi.uio.no> Date: 9 Aug 90 08:28:39 GMT Organization: gisle@ifi.uio.no Lines: 33 Originator: gisle@kyrre.ifi.uio.no 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@nr.no (RFC-822 format) Inet: gisle@ifi.uio.no UUCP: ...!mcvax!ifi!gisle ------------------------------------------------