What is the best data structure for automatically completing text?

I have a long list of words, and I want to show words starting with text entered by the user. When the user enters a character, the application should update the list specified by the user. It should be like an AutoCompleteTextView on Android. I'm just curious about the best data structure for storing words so that the search is very fast.

+5
source share
4 answers

:

, , .

+1

Tries (and their various varieties) are useful here. A more detailed reference on this topic is contained in this document . Maybe you can implement trie completion for Android?

0
source

All Articles