随笔分类 -  算法---字典树

摘要:/* 题意:判断字符串之间是否存在完全覆盖 搞了一下午,一直MLE,动态的表需要释放 内存空间,弄成静态的就不用了*/#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>using namespace std;struct node { struct ... 阅读全文
posted @ 2011-01-17 16:41 kfinder 阅读(842) 评论(0) 推荐(0)
摘要:/* 问题:输入一段英文,对照给的单词的映射,输出映射后的字符串 YY :典型的字典树问题,先处理好映射表,在一映射单词结尾处记录与之对应的单词, 后面字符串处理一下,单个单词进行查,找到后输出,没有输出原始词 刚开始交RE越界,不解,觉得是指针问题,但找不出错处 后来找到个神奇数据后改过就A了 /* START dog aa END START a aa END */*/#... 阅读全文
posted @ 2011-01-16 16:17 kfinder 阅读(1099) 评论(0) 推荐(0)
摘要:/*   问题如题目 典型的字典树,可以当模板 指针的运用; 申请空间;*/#include <stdio.h>#include <string.h>#include <stdlib.h>struct node{ struct node *child[26];//指针,先申请一个地址,后面用到再申请空间 int num;};struct node *root;v... 阅读全文
posted @ 2011-01-16 12:35 kfinder 阅读(321) 评论(0) 推荐(0)