Concerning Trie from Wikipedia:
[Compared to HashTable] Tries support ordered iteration
I am not sure what is meant here first of all. Is it the same as sorted iteration?
Additionally is this supposed to be an inherent feature of this datastructure?
I mean if one uses e.g. a HashSet
for the children of each node in a Trie
we can get O(1)
access trying to find the children to branch or by using a LinkedList
you save space on the nodes.
Perhaps I am way wrong but from my point of view the only way to support ordered
iteration would be to keep array of all keys per node even unused.
Isn't this approach bad?
And one last point:
If the ordered
here is related to insertion order (and not sorted) how would we get that since we insert each word (using the chars as keys) to the corresponding node but I can't see how this gives us information on the insertion order?
Could someone help me clear these things in my mind out?
Thank you.