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 identical and
the n...
分类:
其他好文 时间:
2014-06-19 12:49:17
阅读次数:
301
之前有跟大家分享设置Tab风格和Item圆角的实现,希望能给有需要的朋友一点点帮助,今天再和大家分享一下用ViewPager实现设置分页,小米和OPPO就是这样的设置,先来看看效果图:
为了帮助大家更清晰的理解,我单独拿出一个小例子,有需要的朋友可以下载下来看看:
http://git.oschina.net/way/SettingTab/tree/master
其实要实现...
分类:
移动开发 时间:
2014-06-19 12:14:21
阅读次数:
439
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe...
分类:
其他好文 时间:
2014-06-19 11:23:05
阅读次数:
204
Given an array where elements are sorted in
ascending order, convert it to a height balanced BST.递归,二分法。 1 /** 2 *
Definition for binary tree 3 * st.....
分类:
其他好文 时间:
2014-06-16 00:33:31
阅读次数:
252
Given a binary tree, return the postorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [3,2,1].
Note: Recursive solut...
分类:
其他好文 时间:
2014-06-15 19:06:52
阅读次数:
166
最基本的平衡树操作吧,第一次学splay的可以做一下只需要插入,删除,旋转,求前驱,后继这5个操作吧不喜欢用指针,用数组写的//HNOI2002营业额统计
#include#include#include#include#define INF 1key[root]],root,k); Spla...
分类:
其他好文 时间:
2014-06-13 20:10:15
阅读次数:
282
一、线段树线段树既是线段也是树,并且是一棵二叉树,每个结点是一条线段,每条线段的左右儿子线段分别是该线段的左半和右半区间,递归定义之后就是一棵线段树。例题:给定N条线段,{[2,
5], [4, 6], [0, 7]}, M个点{2, 4, 7},判断每个点分别在几条线段出现过?1、构建线段树2、处...
分类:
其他好文 时间:
2014-06-13 18:43:01
阅读次数:
262
Path Sum: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 giv...
分类:
其他好文 时间:
2014-06-13 16:09:02
阅读次数:
237
Given a binary tree, flatten it to a linked
list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2014-06-13 15:11:35
阅读次数:
273