Re: searching algorithm
- From: "Terry Reedy" <tjreedy@xxxxxxxx>
- Date: Thu, 10 May 2007 15:49:18 -0400
"Neil Cerutti" <horpner@xxxxxxxxx> wrote in message
news:slrnf46ph1.1hg.horpner@xxxxxxxxxxxxxxxxxxxxx
| On 2007-05-10, Gigs_ <gigs@xxxxxxxxxxx> wrote:
| > if user type: "abs" program should list all words above in
| > english and in croatian if user type: "absorb" than program
| > should list last 3 words in english and in croatian
|
| A solution that solves the problem with a data structure might be
| a multi-tree.
Specific computer science terms are prefix tree or trie (from reTRIEval).
http://en.wikipedia.org/wiki/Trie
gives an introduction.
| Each node points at a set of following letters, and a set of
| croatian translations, either of which might be empty, making the
| node a leaf.
|
| For the above (abrideged) dictionary, you would generate (use a
| fixed-width "programmers" font so the tree looks good):
|
| a
| |
| b
| |
| s
| / \
| i o
| / / \
| n l r
| / / \ \
| t u v b->(absorbirati, crpisti)
| / | |
| (pelin)<-h t e->(odrije?iti, osloboditi)
| | |
| (pelin)<-e e->(apsolutan, apsolutni kod)
|
| As the user enter letters, you just march down the tree, printing
| all the words held in leaf nodes held in the current node.
tjr
|
.
- References:
- searching algorithm
- From: Gigs_
- Re: searching algorithm
- From: Neil Cerutti
- searching algorithm
- Prev by Date: Re: path stuff
- Next by Date: Re: keyword checker - keyword.kwlist
- Previous by thread: Re: searching algorithm
- Next by thread: Re: searching algorithm
- Index(es):
Relevant Pages
|