![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树
nnbs
退役老年选手
展开
-
HDOJ 1710Binary Tree Traversals 二叉树的遍历
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1710由先序和中序求后序,递归求解但不建树。//二叉树的遍历#include <iostream> #include <cstdio> #include <cstring> using namespace std; //记录前序和中序 int pre[1010], in[1010]; int n; //原创 2017-02-19 18:03:10 · 352 阅读 · 0 评论 -
HDOJ1251 统计难题 Trie树的基本操作
题目传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1251Trie树是一种特殊的多叉树结构,又称字典树或前缀树。特点是占用内存大(可以尝试左儿子右兄弟存储),但是可以很好的节约时间,时间复杂度为O(N),N为查找或插入的字符串长度。题目中统计含某一前缀的单词数正是Trie树的典型应用。Trie树的定义:typedef struct Trie{ //记原创 2017-01-19 12:55:46 · 302 阅读 · 0 评论