Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes ...
分类:
其他好文 时间:
2017-12-03 13:59:10
阅读次数:
195
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia ...
分类:
其他好文 时间:
2017-12-03 12:55:33
阅读次数:
134
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's ...
分类:
其他好文 时间:
2017-12-03 11:41:35
阅读次数:
159
Invert a binary tree. to ...
分类:
其他好文 时间:
2017-12-03 11:20:09
阅读次数:
132
// 十进制转换二进制 private static String convertBinary(int sum) { StringBuffer binary = new StringBuffer(); while (sum != 0 && sum != 1) { binary.insert(0, s... ...
分类:
其他好文 时间:
2017-12-03 11:19:25
阅读次数:
100
Find the sum of all left leaves in a given binary tree. Example: ...
分类:
其他好文 时间:
2017-12-02 23:24:46
阅读次数:
150
http://sdnhub.cn/index.php/mininet-upgrade-openvswitch/ ...
分类:
Web程序 时间:
2017-12-02 22:05:25
阅读次数:
232
查找基本分类如下: 1. 线性表的查找 顺序查找 折半查找 分块查找 2. 树表的查找 二叉排序树 平衡二叉树 B树 B+树 3. 散列表的查找 今天介绍 二叉排序树 。 二叉排序树 ( Binary Sort Tree ) 又称为 二叉查找树 ,它是一种对排序和查找都很有用的特殊二叉树。 1. 二 ...
分类:
其他好文 时间:
2017-12-02 16:19:27
阅读次数:
192
problem1 link 令$f(x)$表示[0,x]中答案的个数。那么题目的答案为$f(b)-f(a-1)$ 对于$f(x)$来说,假设$x$有$d$位数字,即$[0,d-1]$,那么可以进行动态规划,令$dp(i,s)$表示已经考虑了$[i,d-1]$位的数字,状态为$s$的方案数。状态需要五 ...
分类:
其他好文 时间:
2017-12-02 16:09:51
阅读次数:
190
Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip it up ...
分类:
其他好文 时间:
2017-12-02 13:06:06
阅读次数:
144