普通二叉树寻找公共祖先,二叉树的问题基本就是遍历,最小的公共祖先的满足下面一个性质:1、两个节点分别在左右子树上,2、一个节点是另一节点的祖先 1 class Solution { 2 public: 3 TreeNode* lowestCommonAncestor(TreeNode* ro...
分类:
其他好文 时间:
2015-08-21 15:09:12
阅读次数:
244
http://gogs.io/docs/installation/install_from_binary.htmlwget http://gogs.dn.qbox.me/gogs_v0.6.5_linux_amd64.zip./gogs web:3000/install SQLite 能支持多大数据...
分类:
其他好文 时间:
2015-08-21 13:16:19
阅读次数:
105
乍一看很难,理清思路后很简单的。/** * Definition for binary tree with next pointer. * struct TreeLinkNode { * int val; * TreeLinkNode *left, *right, *next; * TreeL...
分类:
其他好文 时间:
2015-08-21 10:59:05
阅读次数:
160
leetcode -Invert Binary Treenvert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1/** * Defini...
分类:
其他好文 时间:
2015-08-21 01:37:53
阅读次数:
132
leetcode - Lowest Common Ancestor of a Binary Search TreeGiven a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in...
分类:
其他好文 时间:
2015-08-20 23:58:08
阅读次数:
393
题目:
Given a binary tree, return all root-to-leaf paths.
For example, given the following binary tree:
1
/ 2 3
5
All root-to-leaf paths are:
["1->2->5", "1->3"]
...
分类:
编程语言 时间:
2015-08-20 22:38:02
阅读次数:
259
可能没想到,人的简单方法,关于质询的问题提出做。如何把产生出来的所有的树木?所使用的方法当然是递归,但是有一个致命的问题,假设根节点,然后做一个递归,所以这是非常多的公共树木的根,结果肯定是一团糟。怎么办?事实上,在思想上先实践的数量目前正在寻求高度统一,先把全部的左右子树都求出来。然后把它们之间的...
分类:
其他好文 时间:
2015-08-20 22:32:55
阅读次数:
215
先序遍历,用递归来做,简单的不能再简单了。代码如下:/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * ...
分类:
其他好文 时间:
2015-08-20 22:18:26
阅读次数:
179
RPM是RedHat Package Manager(RedHat软件包管理工具)类似Windows里面的“添加/删除程序”
rpm 执行安装包
二进制包(Binary)以及源代码包(Source)两种。二进制包可以直接安装在计算机中,而源代码包将会由RPM自动编译、安装。源代码包经常以src.rpm作为后缀名。
常用命令组合:
-ivh:安装显示安装进度--install--ve...
分类:
其他好文 时间:
2015-08-20 19:03:33
阅读次数:
252
题目:
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
1 3 3 2 ...
分类:
编程语言 时间:
2015-08-20 15:22:03
阅读次数:
180