Binary Tree Longest Consecutive Sequence
分类:
其他好文 时间:
2016-02-25 01:36:25
阅读次数:
188
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
分类:
其他好文 时间:
2016-02-24 22:52:35
阅读次数:
176
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
分类:
其他好文 时间:
2016-02-24 22:44:15
阅读次数:
195
题目来源: https://leetcode.com/problems/unique-binary-search-trees-ii/ 题意分析: 给一个整数,返回所有中序遍历是1到n的树。 题目思路: 这可以用递归的思想。首先确定根节点,如果k是根节点,那么1-k-1是左子树,而k+1-n为右子树。
分类:
编程语言 时间:
2016-02-24 22:27:01
阅读次数:
287
题目来源: https://leetcode.com/problems/unique-binary-search-trees/ 题意分析: 给定一个整数n,返回所有中序遍历是1到n的树的可能。 题目思路: 这是动态规划的题目。选定了第k个为根节点,那么所有的可能就是ans[k-1] * ans[n
分类:
编程语言 时间:
2016-02-24 22:25:01
阅读次数:
178
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes
分类:
其他好文 时间:
2016-02-24 20:57:44
阅读次数:
158
文章翻译自:《BRISK: Binary Robust Invariant Scalable Keypoints》Stefan Leutenegger, Margarita Chli etl.
BRISK 摘要:从一幅图片中高效地寻找关键点始终是一个深入研究的话题,以此形成了众多的计算机视觉应用的基础。正在这个领域中,先驱算法SIFT和SURF在各种图形转换中表现出了巨大的性能,特别是SURF在日益更新的高性能方法中被认为是计算最有效的方法。本文提出的BRISK算法是用于关键点检测,描述和匹配的一种新方法。...
分类:
其他好文 时间:
2016-02-24 19:34:46
阅读次数:
592
complete binary tree:除最后一行外每一行的节点都有两个儿子,最后一行的节点尽可能靠左。 ver0: 1 class Solution { 2 public: 3 int countNodes(TreeNode* root) { 4 if(!root) return 0; 5 re
分类:
其他好文 时间:
2016-02-24 19:25:44
阅读次数:
136
Flatten a binary tree to a fake "linked list" in pre-order traversal. Here we use the right pointer in TreeNode as the nextpointer in ListNode. Exampl
分类:
其他好文 时间:
2016-02-24 19:20:04
阅读次数:
168
1 class Solution { 2 public: 3 void flatten(TreeNode* root) { 4 if(!root) return; 5 flatten(root->left); 6 flatten(root->right); 7 8 TreeNode* right =
分类:
其他好文 时间:
2016-02-24 17:29:21
阅读次数:
118