Data structure used for search suggestions
What is the data structure used for search suggestions like Google Suggest开发者_如何学Python. Does it all depend on the application? Would be helpful someone give me a link to good reference!
Consider a Trie. Here's a discussion about good implementations. This book will give more in-depth coverage.
But this approach assumes that what has already been typed is spelled correctly. If that is not a reasonable assumption, you will need to do something more sophisticated.
You can search for "autocomplete".
Here's a tutorial for a jQuery plugin that does autocomplete.
Here's a video for how it's done.
And here's really a lot of information about a detailed version.
精彩评论