AutoComplete implementation - Interview Question
Posted
by user181218
on Stack Overflow
See other posts from Stack Overflow
or by user181218
Published on 2010-04-07T09:09:49Z
Indexed on
2010/04/07
9:13 UTC
Read the original article
Hit count: 254
data
|data-structures
Hi,
Say you have a DB table with two cols: SearchPhrase(String) | Popularity(Int).
You need to initialize a DS so that you could use it to implement an autocomplete feature (like google suggest) comfortably. The requirement: Once the data from the db is processed into the data structure, when you type a letter you get the 10 most popular searchphrases from the db starting with that letter,then when you type the next one you get the 10 .... with these two letters and so on.
The question only concerns planning the ds and pseudocoding Insert,Search etc.
Note: YOU CANNOT USE TRIE DS.
Any ideas?
© Stack Overflow or respective owner