文件名称:trie
- 所属分类:
- 数据结构常用算法
- 资源属性:
- [Windows] [Visual.Net] [源码]
- 上传时间:
- 2016-07-14
- 文件大小:
- 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.
输入
输入的第一行为一个正整数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.vcxproj
....\....\trie.vcxproj.filters
....\trie.sdf
....\trie.sln
....\trie.v12.suo
....\trie
trie