B树、B-树、B+树、B*树、红黑树rbtree 二叉排序树、trie树Double Array 字典查找树
B树
即二叉搜索树:
1.所有非叶子结点至多拥有两个儿子(Left和Right);
2.所有结点存储一个关键字;
3.非叶子结点的左指针指向小于其关键字的子树,右指针指向大于其关键字的子树;
...
分类:
其他好文 时间:
2014-07-26 02:24:36
阅读次数:
232
使用Trie树完成。比STL map 快很多。输出时DFS,用一个字符数组记录当前字符串。走到是字符串的结点就输出。代码如下。#include #include #include #include #include #include using namespace std;const int Max...
分类:
其他好文 时间:
2014-07-25 10:52:21
阅读次数:
236
Problem Description
In the modern time, Search engine came into the life of everybody like Google, Baidu, etc.
Wiskey also wants to bring this feature to his image retrieval system.
Every image hav...
分类:
其他好文 时间:
2014-07-24 23:22:23
阅读次数:
256
Phone List
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 22235
Accepted: 6885
Description
Given a list of phone numbers, determine if it is consistent in...
分类:
其他好文 时间:
2014-07-24 23:08:34
阅读次数:
272
Problem Description
In the year 8888, the Earth is ruled by the PPF Empire . As the population growing , PPF needs to find more land for the newborns . Finally , PPF decides to attack Kscinow w...
分类:
其他好文 时间:
2014-07-24 12:25:06
阅读次数:
219
1123: 统计难题
时间限制: 1 Sec 内存限制: 128 MB
提交: 4 解决: 4
[提交][状态][讨论版]
题目描述
Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).
输入
输入数据的第一部分是一张单词表,每行一个单...
分类:
其他好文 时间:
2014-07-24 10:23:14
阅读次数:
184
Problem Description
Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).
Input
输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串...
分类:
其他好文 时间:
2014-07-23 22:34:37
阅读次数:
296
Problem Description
Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leave...
分类:
其他好文 时间:
2014-07-23 22:33:38
阅读次数:
281
解题报告
Tire树。
#include
#include
#include
#include
using namespace std;
struct node
{
int v;
node *next[256];
};
int cnt=0,q;
char ch[100],str1[100];
node *newnode()
{
node *p=new node;...
分类:
其他好文 时间:
2014-07-23 21:00:15
阅读次数:
250
题目来源:POJ 1451 T9
题意:给你一些单词 和优先值 然后当你按下数字的时候首先会出现哪个单词 就是我们平时手机的按键
思路:建一颗字典树 因为按一个数字对应多个字母 那么就有多种情况 我们要输出权值最大的一个 我用了优先队列 这里每个前缀的优先值是所有单词优先值的和
例如abc 5 abd 6 acd 7 那么a这个前缀的优先值是18 ab的优先值是11
#include
#...
分类:
其他好文 时间:
2014-07-22 22:34:34
阅读次数:
261