I’d like to implement a simple class (in Java) that would allow me to register and deregister strings, and on the basis of the current set of strings auto-complete a given string. So, the interface would be:
- void add(String)
- void remove(String)
- String complete(String)
What’s the best way to do this in terms of algorithms and data-structures?
you should consider to use a PATRICIA trie for the data structure. Search for ‘patricia trie’ on google and you’ll find a lot of information…