实现字典
嗨,
我遇到了一个面试问题,关于实现一个字典,它可以实现自动完成,自动更正,拼写检查等功能...
我实际上想知道哪种数据结构最适合实现字典以及如何实现接近上述所需的功能...
欢迎任何指导我的链接...
Hii ,
I ran across a interview question of implementing a dictionary that can implement the features of auto-completion , auto - correction , spell check etc...
I actually wanted to know which data structure is the best for implementing a dictionary and how one approaches the above required features...
Any links that guide me on this are welcome...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于此类问题,有相同的答案:Trie。看看这里..
还有后缀树(或帕特里夏树)可以用于此目的..
There is just the same answer for this kind of problem: a Trie. Take a look here..
Also suffix trees (or Patricia Trees) can be useful for this purposes..
Tries 是一种常见的结构。它们是有限状态自动机的特例,也用于 字典构建和拼写检查。
Tries are a common structure for this. They are a special case of finite-state automata, which have also been used for dictionary construction and spell checking.
您可以使用任何排序的容器获得自动完成功能,例如一组字符串:
You can get auto-completion with any sorted container, for example a set of strings: