码迷,mamicode.com
首页 >  
搜索关键字:binary tree    ( 23211个结果
LeetCode "Symmetric Tree"
Recursive.class Solution { public: bool isSymmetric(TreeNode *pl, TreeNode *pr) { if (!pl && !pr) return true; if ((pl && !pr)...
分类:其他好文   时间:2014-07-22 00:36:36    阅读次数:197
STL 源码剖析 算法 stl_heap.h
heap ------------------------------------------------------------------------- binary heap 是一种完全二叉树。 隐式表示法:以 array 表述 tree。 小技巧:将 array 的 #0 元素保留,则第 i 个元素的左右子节点分别是 2i 和 2i + 1, 父节点是i/2 --> STL 里没有采用这种小技巧 将 array 无法动态改变大小,所以用 vector 替代 array 这个文件里提供了各种堆操作的...
分类:其他好文   时间:2014-07-22 00:32:34    阅读次数:256
hoj Counting the algorithms
贪心加树状数组 给出的数据可能出现两种情况,包含与不包含,但我们从右向左删就能避免这个问题; #include #include #include using namespace std; const int maxn=200010; int f[maxn],l[maxn],a[maxn]; long long tree[maxn]; int n; inline int lowbit(int ...
分类:其他好文   时间:2014-07-22 00:27:36    阅读次数:210
hdu 1166线段树
线段树的一般模板,1.结构体数组tree来存储 2.线段树的构建函数buildTree 3.改变元素值函数update 4.查询区间内总和的函数query全部使用递归来实现 ######################################################################include #include #include #include us...
分类:其他好文   时间:2014-07-21 11:44:15    阅读次数:183
STL_稀疏图,树_使用vector邻接表存储
本文出自:http://blog.csdn.net/svitter 分析:vector是STL模板中的容器。可以利用其性质来构建邻接表。 定义: #include #define MAXN 10000 //max n of a tree or graph //if is a tree, n / 2 is OK ; using namespace std; typedef ve...
分类:其他好文   时间:2014-07-21 11:27:55    阅读次数:228
MySQL学习(二)复制
复制解决的问题是保持多个服务器之间的数据的一致性,就如同通过复制保持两个文件的一致性一样,只不过MySQL的复制要相对要复杂一些,其基本过程如下: 1)在主库上将数据更改记录到二进制日志(Binary Log)中(这些记录被成为二进制日志事件,即binlog) 2)本分将主库上的日志复制到自...
分类:数据库   时间:2014-07-21 11:23:00    阅读次数:300
LeetCode "Balanced Binary Tree"
Another recursion problem.class Solution {public: int getHeight(TreeNode *p) { if (!p) return 0; int hL = 1; if (p->left) h...
分类:其他好文   时间:2014-07-21 11:10:03    阅读次数:180
C#_deepCopy
using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Runtime.Serialization.Formatters.Binary;using System.Text...
分类:其他好文   时间:2014-07-21 08:03:51    阅读次数:197
在Mac OS X上利用Spotlight搜索代码
用grep来搜代码和方便,最原生态了,常用的: ??~?grep?‘NuPlayer‘?-iInr?--color?./aosp 其中`i`表示大小写忽略;`I`表示忽略binary文件;`n`显示搜索结果的行号;`r`表示递归搜索子目录 不过grep搜索有点...
分类:其他好文   时间:2014-07-20 23:30:42    阅读次数:446
C++ Binary Tree Traversal
关于二叉树的遍历有很多的方法, 下面介绍两个经典的遍历算法: BFS和DFS。一个是深度优先遍历, 一个是广度有优先遍历。 这两种遍历算法均属于盲目的遍历算法, 一般而言, 启发式的遍历搜索算法比较好一些。 。 关于各种遍历算法的对比, 将会在后面逐一提及。 这里不在赘述。 由于树是一个非线性的数据结构, 显然不能像linked list , 或者Array那样通过从头像最末尾移动去实现遍历每一...
分类:编程语言   时间:2014-07-20 23:14:21    阅读次数:387
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!