Description:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 uniqu...
分类:
其他好文 时间:
2015-06-18 19:40:04
阅读次数:
133
Description: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 ...
分类:
其他好文 时间:
2015-06-18 19:15:25
阅读次数:
93
Program counter The program is stored in memory with the first instruction at binary address 0000, the second instruction at address 0001, the thir...
分类:
其他好文 时间:
2015-06-18 19:12:27
阅读次数:
93
算法很easy。直接附着到代码它#include using namespace std;templateint binary_search(const T s[],const int size,const T &m){ if(size 0 && i >= 0 && i s[i]){ i +...
分类:
编程语言 时间:
2015-06-18 19:08:12
阅读次数:
131
Path Sum II
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum
= 22,
5
...
分类:
其他好文 时间:
2015-06-18 17:29:24
阅读次数:
108
Invert a binary tree. 4
/ 2 7
/ \ / 1 3 6 9to 4
/ 7 2
/ \ / 9 6 3 1解题思路递归实现代码C++:// Runtime: 3 ms
/**
* Definition for a binary tree node.
* struct...
分类:
其他好文 时间:
2015-06-18 17:22:30
阅读次数:
82
Invert a binary tree.
4
/ 2 7
/ \ / 1 3 6 9
to
4
/ 7 2
/ \ / 9 6 3 1
Trivia:
This problem was inspired by this
original tweet by Max
Howe...
分类:
其他好文 时间:
2015-06-18 09:47:06
阅读次数:
180
hashmap map key and value for highly efficient lookup.hashmap search used binary tree O(log2)main methodsint size();hashmap.put(key,value);Value get(k...
分类:
其他好文 时间:
2015-06-18 08:12:52
阅读次数:
99
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:
其他好文 时间:
2015-06-18 00:36:46
阅读次数:
69
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:
其他好文 时间:
2015-06-17 23:18:38
阅读次数:
155