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 an...
分类:
其他好文 时间:
2014-11-09 06:16:58
阅读次数:
170
Given inorder and postorder traversal of a tree, construct the binary tree.Solution: 1 /** 2 * Definition for binary tree 3 * public class TreeNode .....
分类:
其他好文 时间:
2014-11-09 06:16:44
阅读次数:
215
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For ...
分类:
其他好文 时间:
2014-11-09 06:13:51
阅读次数:
122
题目:给定两个二进制字符串,返回相加的结果,也是二进制表示。主要就是考查进位如何操作,以及最后如果加完之后进位还是1的话那么不能漏了还要加1.跟之前有做过一题的类似。因为这题easy就是判断,所以直接贴代码了,感觉好长的样子。class Solution {public: string add...
分类:
其他好文 时间:
2014-11-09 00:58:42
阅读次数:
130
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Solution: 1 /** 2 * Definition for binary tree 3 * .....
分类:
其他好文 时间:
2014-11-09 00:58:31
阅读次数:
213
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...
分类:
其他好文 时间:
2014-11-09 00:55:08
阅读次数:
250
Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:
其他好文 时间:
2014-11-08 23:36:00
阅读次数:
202
原创性申明:
本文地址是 http://blog.csdn.net/zhujunxxxxx/article/details/40658925 转载请注明出处。作者联系邮箱 zhujunxxxxx@163.com
二叉排序树
(Binary Sort Tree)又称二叉查找树(Binary Search Tree),亦称二叉搜索树。
它或者是一棵空树;或者是具有下列性质的二叉树:
(1)若...
分类:
编程语言 时间:
2014-11-08 22:15:05
阅读次数:
211
1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(i...
分类:
其他好文 时间:
2014-11-08 21:58:27
阅读次数:
179
题意:
Given a binary tree, return the inorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,3,2].
Note: Recursive solution is trivial, could you do it iteratively?...
分类:
其他好文 时间:
2014-11-08 19:43:46
阅读次数:
188