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...
分类:
其他好文 时间:
2014-07-02 22:34:44
阅读次数:
318
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 =...
分类:
其他好文 时间:
2014-07-02 22:10:42
阅读次数:
262
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:
其他好文 时间:
2014-07-02 21:13:05
阅读次数:
170
Same Tree 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 i...
分类:
其他好文 时间:
2014-07-02 17:56:50
阅读次数:
205
前面介绍的栈、队列都是线性结构(linear structure)。而树是非线性结构(non-linear structure)。因此,树中的元素之间一般不存在类似于线性结构的一对一的关系,更多地表现为多对多的关系。直观地看,它是数据元素(在树中称为节点)按分支关系组织起来的结构。显然,树形结构是比线性结构更复杂的一种数据结构类型。树的定义:树是含有n个节点的有穷集合,其中有一个节点比较特殊称为根节点。在图示树时,用一条边连接两个有逻辑关系的节点,这个关系被称为父子关系。二叉树(Binary Tree)由节...
分类:
其他好文 时间:
2014-07-02 16:44:33
阅读次数:
183
往往在一个绘图区域会有很多个图形,如果通过右键拖动画布或者通过滚动条来查找,是一件很烦人的事情。下面我就给出解决这个问题的方案。
前提是有一个整个绘图区域的tree或者datagrid,我们需要选择直接要定位的图形cell。
首先我们需要一个mxGraph的全局对象,暂且就定义为ylEditor.ylCanvas吧。
接下来我们要定义一个查找图形cell的方法,只有通过这个方法,才能找到画布...
分类:
其他好文 时间:
2014-07-02 15:26:39
阅读次数:
547
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.
分类:
其他好文 时间:
2014-07-02 10:03:09
阅读次数:
175
[LeetCode]Maximum Depth of Binary Tree...
分类:
其他好文 时间:
2014-07-02 08:09:01
阅读次数:
175
判断一个二叉树是否是轴对称的是一个经典的算法问题,下面结合leetcode上的Symmetric Tree给出判断对称树的两种方法。
先看看问题描述:
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, t...
分类:
其他好文 时间:
2014-07-02 06:58:05
阅读次数:
208