Algorithm for autocomplete?

后端 未结 9 1275
暖寄归人
暖寄归人 2020-11-28 00:45

I am referring to the algorithm that is used to give query suggestions when a user types a search term in Google.

I am mainly interested in: 1. Most important resul

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 01:15

    If you are looking for an overall design for the problem, try reading the content at https://www.interviewbit.com/problems/search-typeahead/.

    They start by building autocomplete through a naive approach of using a trie and then build upon it. They also explain optimization techniques like sampling and offline updates to cater to specific use cases.

    To keep the solution scalable, you would have to shard your trie data intelligently.

提交回复
热议问题