背后T9型词典的数据结构 [英] Data structure behind T9 type of dictionary

查看:106
本文介绍了背后T9型词典的数据结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何做一个T9词典的工作?背后是什么数据结构。如果我们输入4663,我们得到'好'的时候,我们preSS向下按钮,我们得到'水涨船高',那么'家'等......

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...

编辑:如果46用户类型,那么它应该显示走出去,当pressed向下箭头应该显示走了等......

If the user types in 46 then it should show 'go' and when pressed down arrow should show 'gone' etc...

推荐答案

有可以以多种方式来实现,其中之一是 Trie树。这条路线是重新通过数字psented $ P $和节点指向集合的话。

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.

可以使用嵌套哈希表以及实施,哈希表的关键是一个字母,每数字的算法计算出所有可能的途径(O(3 ^ n)的路由)。

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).

这篇关于背后T9型词典的数据结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆