大家给点意见

imperalism 2009-11-04 11:16:24
Suppose that we have a large collection of words in the English language, represented as strings. (Maybe these are obtained by reading in one or more text files.) Now suppose that we wish to quickly answer a query that asks if a given word is in our collection. Maybe the query involves the string "measure" -- we want to say whether this is in our collection or not. This is easy to do if we use a hash table to store our collection.

Let us assume that we want to answer the queries in a more robust way: If the user queries "maesure" or say "mesure", we still want to output a hopefully small list of words in our collection that includes "measure" (assuming "measure" is in our collection). That is, if the user queries with a string that is close to one of the words in our collection, we should output a small set of words from our collection that includes the right word. Our goal is to develop a reasonable solution to this problem based on variants of hash table ideas.

大家给点建议应该怎么设计啊!!
谢谢了
...全文
31 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
狼里格东 2009-11-04
  • 打赏
  • 举报
回复
噢,忘记了一点

可以使用regEx正则表达式来匹配相关的数据,再存放进List和HashMap,其中可以相互转换下
狼里格东 2009-11-04
  • 打赏
  • 举报
回复
1、IO流读取数据
2、用List和HashMap分别进行组合
3、弄个方法用户查询
4、一个输出所有的集合
5、用户查询呢,返回一个小清单,符合所有条件的即可


貌似这是基础代码,每个新手都要经历的。我都刚做完类似的

因为不太相同,但思路大致相同,也不知道怎么给你提示,就这么提醒下
imperalism 2009-11-04
  • 打赏
  • 举报
回复
你能说的具体点吗,就用hashtable怎么个hash
然后那个hashcode()是要自己重新写的,应该怎么写

51,410

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧