问题描述:
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
解题思路:...
分类:
其他好文 时间:
2014-08-01 13:48:11
阅读次数:
183
该代码实现了tree的结构,依赖dyArray数据结构。有first一级目录,second二级目录。
dyArray的c实现参考这里点击打开链接 hashTable的c实现参考这里点击打开链接
下面是跨平台的数据类型定义
//
// cpPlatform.h
// dataStruct
//
// Created by hherima on 14-7-29.
// Copyrigh...
分类:
编程语言 时间:
2014-08-01 13:46:21
阅读次数:
279
为了提高查找效率,这里将敏感词用树形结构存储,每个节点有一个map成员,其映射关系为一个string对应一个TreeNode。STL::map是按照operator 2 #include 3 //#include 4 using namespace std; 5 6 7 class Tree...
分类:
编程语言 时间:
2014-08-01 13:31:41
阅读次数:
486
POJ 2828题目大意是说有n个插入操作,每次把B插入到位置A,原来A以后的全部往后移动1,球最后的序列tree里保存的应该是这整个区间还有多扫个位置可以插入数据,那么线段树里从后往前扫描依次插入数据比如现在吧B插入到A位置,如果整个区间左侧还有>1; 6 7 if(x 2 #incl...
分类:
其他好文 时间:
2014-08-01 13:31:31
阅读次数:
177
Mobile phoneshttp://poj.org/problem?id=1195 1 #include 2 #include 3 #define mt(a,b) memset(a,b,sizeof(a)) 4 const int M=1030; 5 class Two_Tree_Array {...
分类:
其他好文 时间:
2014-08-01 13:03:01
阅读次数:
168
//文件或目录转换成 TreeViewprocedure DirToTreeView(Tree: TTreeView; Directory: string; Root: TTreeNode; IncludeFiles:Boolean);varSearchRec: TSearchRec;ItemTem...
分类:
其他好文 时间:
2014-08-01 12:52:21
阅读次数:
267
题目:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 w....
分类:
编程语言 时间:
2014-08-01 06:57:21
阅读次数:
297
求解最小生成树(Minimum Cost Spanning Tree,以下简写做MST)是图相关的算法中常见的一个,本篇介绍两种求解MST的算法:Prim和Kruskal,然后测试之。
分类:
其他好文 时间:
2014-08-01 06:57:11
阅读次数:
394
题目:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.题解:这道题跟pre....
分类:
编程语言 时间:
2014-08-01 06:56:51
阅读次数:
185
题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.题解: 1 ...
分类:
编程语言 时间:
2014-08-01 06:56:41
阅读次数:
228