searching algorithm
Gordon Airporte
JHoover at fbi.gov
Thu May 10 16:38:41 EDT 2007
> 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.
>
Call me dense, but how does one do this in Python - which doesn't have
pointers? Dictionaries with dictionaries within dictionaries... (with
each letter as the key and the its children as values) is going to be
extremely space inefficient, right?
More information about the Python-list
mailing list