Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to thedefinition of LCA on Wikipedia: ...
分类:
其他好文 时间:
2015-07-11 10:27:33
阅读次数:
113
leetcode 235: Lowest Common Ancestor of a Binary Search Tree...
分类:
其他好文 时间:
2015-07-11 07:54:07
阅读次数:
130
1.binary heap实现BinaryHeap.h#ifndef BINARYHEAP_H#define BINARYHEAP_Hclass BinaryHeap{ public: BinaryHeap(int N); bool isEmpty(); ...
分类:
其他好文 时间:
2015-07-10 22:10:53
阅读次数:
233
https://leetcode.com/problems/unique-binary-search-trees/ 1 class Solution { 2 public: 3 int numTrees(int n) { 4 //典型的动态规划问题 5 //先...
分类:
其他好文 时间:
2015-07-10 22:04:23
阅读次数:
115
Given a binary tree, return the preorder traversal of its nodes’ values.For example:
Given binary tree {1,#,2,3},
1
\
2
/
3
return [1,2,3].Note: Recursive solution is trivial,...
分类:
其他好文 时间:
2015-07-10 20:53:50
阅读次数:
123
1 #----------------------------------- 2 #1.正则表达式检索 [RegexP] 3 #----------------------------------- 4 # * Binary字段可以支持大小写匹配 5 # * 文本开始^(集合中是否定) 结束$ 6....
分类:
数据库 时间:
2015-07-10 19:01:26
阅读次数:
198
通道:http://acm.hdu.edu.cn/showproblem.php?pid=1693题意:多回路路径方案数,无障碍。代码: 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 const i...
分类:
其他好文 时间:
2015-07-10 18:40:44
阅读次数:
121
https://leetcode.com/problems/binary-tree-inorder-traversal/递归中序遍历 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int v...
分类:
其他好文 时间:
2015-07-10 18:21:58
阅读次数:
122
Maximum Depth of Binary Tree (DFS, TREE)Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path fr...
分类:
其他好文 时间:
2015-07-10 13:17:22
阅读次数:
99