I need to create a Tree of words with the class Dictionary in as3.
I will show a schema of what i desire:
a b ......
/ \ / \
an ad .... be bi ......
/ \ / \ / \ / \
ant and …
/ \ / \
… .. …..
and so on…..
So, i want to check (given a particular word) exists in my particular dictionary.
I have an array with my set of words (let’s say 10.000), how should i fill the dictionary?
Thanks.
Correct me if I’m wrong but it looks like maybe you’re confusing the
Dictionarywith the book kind of dictionary. In AS3, aDictionaryis like anArrayexcept it uses a object (key) to look up another object (value). You could use this but you’d probably have to nest hundreds of them together to get the result you want.I think for this particular case you would want to look at using some type of Tree data structure. Unfortunately, there is no native
Treeclass in AS3 but you could find more information about them online (WikiPedia) and I know you can get a solid implementation of a tree in this DS library by Polygonal.