码迷,mamicode.com
首页 >  
搜索关键字:binary tree right si    ( 32903个结果
LeetCode "Populating Next Right Pointers in Each Node"
Apparently BFS is the most obvious one.. but it is not that simple - only constant extra space is provided.Then the only strategy to take is recursion...
分类:其他好文   时间:2014-07-22 00:39:35    阅读次数:258
uva 458 - The Decoder
The DecoderWrite a complete program that will correctly decode a set of characters into a valid message. Your program should read a given file of a si...
分类:其他好文   时间:2014-07-22 00:38:34    阅读次数:235
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
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
【leetcode】Sum Root to leaf Numbers
简单的二叉树的先根遍历模板的应用 class Solution: # @param root, a tree node # @return an integer def hehe(self, num, root): #再原来的基础上*10,再加上当前的root.val num = num * 10 + root.val ...
分类:其他好文   时间:2014-07-20 22:45:33    阅读次数:299
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!