Boolean
Boolean

Reputation: 14664

Algorithm used for auto-suggestion

Which algorithms or data structures are used in auto-suggest features?

It seems that edit-distance will be used, but again a frequency or score associated with each word should also be considered. For example, consider the tags option on SO's Ask Question page.

Upvotes: 4

Views: 2894

Answers (3)

Akm Ajay K Maheshwari
Akm Ajay K Maheshwari

Reputation: 41

hi raccha , Autosuggestion system work on recursive Algorithm.Google & facebook are implement this algo in his formation . facebook are use graph+recursive type alog. i am give you example for that. if you are type f in facebook search bar then you can saw that facebook is search that how many persons or pages which you like or add. first letter is f then it is showing suggestion's

Upvotes: 0

Bobby
Bobby

Reputation: 18305

Take a look at the links provided in the answers to this stackoverflow question autocomplete algorithms, papers, strategies, etc., you may find what you're looking for there.

Upvotes: 1

Jack
Jack

Reputation: 133577

You can use a trie:

  • every node of the trie has all the children that begins with the value itself, for example: from "in" node you can visit the subtree of all strings starting with "in"
  • in your case you have to consider score so you can first gather all children (traversing the tree) and then sort them according to the score or whatever
  • if you really want to keep Hamming Distance (edit-distance) you can adapt the trie to build children according to it

Upvotes: 5

Related Questions