书山有径勤为路>>>>>>>>

<<<<<<<<学海无涯苦作舟!

随笔分类 -  C Trie

简单字典树练习
摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1251这个相当简单就不解释了。直接上代码。View Code #include "iostream"#include "cstdio"#include "cstring"#include "string"using namespace std;typedef struct node{ int Cross; struct node *next[26];}node;node *head;void InitHead(){ head 阅读全文

posted @ 2012-04-26 20:48 More study needed. 阅读(167) 评论(0) 推荐(0)

链表的典型应用——字典树
摘要:题目:http://acm.swust.edu.cn/oj/problem/842/这个题目是有一点复杂的,因为在存储内容的时候又再次用了链表。可以说它是链表题目的相当典型的例子了。还是直接上代码吧。View Code #include "iostream"#include "cstring"#include "string"#include "cstdio"#include "algorithm"#include "malloc.h"using namespace std; 阅读全文

posted @ 2012-04-26 20:08 More study needed. 阅读(268) 评论(0) 推荐(0)

Trie解决POJ 2503
摘要:题目:http://poj.org/problem?id=2503就是一个字典树的简单应用, 不解释。View Code #include "iostream"using namespace std;typedef struct node{ char word[21]; int mark; struct node * next[26];}node;node * root;void InitRoot(){ root = new node(); root->mark=0; memset(root->next, NULL, sizeof(root->next)) 阅读全文

posted @ 2011-10-02 17:10 More study needed. 阅读(286) 评论(0) 推荐(0)

导航

书山有径勤为路>>>>>>>>

<<<<<<<<学海无涯苦作舟!