Extending trie to higher number of leaves

74 Views Asked by At

I have to make a dictionary using tries, the number of letters in the alphabet will increase from 26 to 120, and hence the numb er of leaf nodes will increase exponentially. What optimisations can I use so that my lookup, insertion and deletion time doesn't increase exponentially?

EDIT Making the question clearer, sorry for the lack of details I am using a multiway trie like radix tree and making some modifications to it. My question is if I know that the word size will increase (for sure) from 26 to 120, it will increase the depth of the tree. Is it possible to decrease the increase in depth by increasing the key to more than 64 bits (the register can gold maximum 64 bits)?

2

There are 2 best solutions below

1
Matt Timmermans On

It's often better to use binary tries with path compression (Patricia tries) based on the binary representation of your keys. That way you get the benefits of the smallest possible alphabet, and you still only have 2 nodes (one leaf and one internal) per key.

0
displayName On

Though there may be some optimizations otherwise but our lookup, insertion and deletion time will not increase exponentially. Increasing your alphabet set only means that your each trie node will be bigger now. The path to each word will still have the same length which is equal to the letters in the word.