trie4j
trie4j copied to clipboard
removing an entry from a MapPatriciaTrie
Hello,
is it possible to remove an entry from a MapPatriciaTrie ?
There is no method for removing elements from Trie. You still can implement remove function by treating null value as delete flag.
Functionnally that would work but the key would still be stored inside the trie. This is a problem if the use case is one of "routing" (which is mine). At any given time I may have only up to N element, however elements comes and without the ability to remove keys, the structure will keep growing. Would be nice to have a feature to either remove a key or at least a "clean" method that would remove all the "null" elements from the trie and perform pruning optimization accordingly (I reckon this can be done manually by creating a new trie and adding only non-null elements).