CDN加速镜像 | 设为首页 | 加入收藏夹
当前位置: 首页 资源下载 源码下载 数值算法/人工智能 数据结构常用算法

文件名称:trie

  • 所属分类:
  • 标签属性:
  • 上传时间:
    2016-07-13
  • 文件大小:
    1.32mb
  • 已下载:
    0次
  • 提 供 者:
  • 相关连接:
  • 下载说明:
    别用迅雷下载,失败请重下,重下不扣分!

介绍说明--下载内容来自于网络,使用问题请自行百度

trie 树实现

输入

输入的第一行为一个正整数n,表示词典的大小,其后n行,每一行一个单词(不保证是英文单词,也有可能是火星文单词哦),单词由不超过10个的小写英文字母组成,可能存在相同的单词,此时应将其视作不同的单词。接下来的一行为一个正整数m,表示小Hi询问的次数,其后m行,每一行一个字符串,该字符串由不超过10个的小写英文字母组成,表示小Hi的一个询问。



在20 的数据中n, m< 10,词典的字母表大小< 2.



在60 的数据中n, m< 1000,词典的字母表大小< 5.



在100 的数据中n, m< 100000,词典的字母表大小< 26.



本题按通过的数据量排名哦~



输出

对于小Hi的每一个询问,输出一个整数Ans,表示词典中以小Hi给出的字符串为前缀的单词的个数。-Trie tree implementation

input

Input the first act a positive integer n, said the dictionary size, followed by N lines, each line of a word (not guaranteed is English words, there may be a Martian words Oh), words consist of no more than 10 lowercase letters, may the same word, this should be regarded as different words. The next act a positive integer m, said the number of small Hi query, then m lines, each line of a string, the string consists of no more than 10 lowercase letters of the alphabet, said a small Hi of a query.

In 20 of the data in the m< 10, N, dictionary of the alphabet size < 2.

In 60 of the data in the m< 1000, N, dictionary of the alphabet size < 5.

In 100 of the data in the m< 100000, N, dictionary of the alphabet size < 26.

According to the amount of data by ranking Oh ~

output

For each of the small Hi query, the output of an integer Ans, which is a small Hi in the dictionary given the string as the prefix of the number of words.
(系统自动生成,下载前可以参看下载内容)

下载文件列表

trie/trie/main.cpp
trie/trie/trie.vcxproj
trie/trie/trie.vcxproj.filters
trie/trie.sdf
trie/trie.sln
trie/trie.v12.suo
trie/trie
trie

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 搜珍网是交换下载平台,只提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。更多...
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或换浏览器;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*快速评论: 推荐 一般 有密码 和说明不符 不是源码或资料 文件不全 不能解压 纯粹是垃圾
*内  容:
*验 证 码:
搜珍网 www.dssz.com