Data structure behind T9 type of dictionary

前端 未结 6 1714
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 11:34

How does a T9 dictionary work? What is the data structure behind it. If we type \'4663\' we get \'good\' when we press down button we get \'gone\' then \'home\' etc...

6条回答
  •  离开以前
    2020-12-07 12:05

    It can be implemented in several ways, one of them is Trie. The route is represented by the digits and the nodes point to collection of words.

    It can be implemented using nested hash tables as well, the key of the hash table is a letter and on every digit the algorithm calculates all possible routes (O(3^n) routes).

提交回复
热议问题