题目:Given a binary tree, determine if it is a valid
binary search tree (BST).Assume a BST is defined as follows:The left subtree of
a node contains onl...
分类:
其他好文 时间:
2014-05-23 12:20:50
阅读次数:
407
Given a binary tree, find its maximum depth.The
maximum depth is the number of nodes along the longest path from the root node
down to the farthest le...
分类:
其他好文 时间:
2014-05-23 11:54:10
阅读次数:
317
题目:Two elements of a binary search tree (BST) are
swapped by mistake.Recover the tree without changing its structure.Note:A
solution using O(n) space ...
分类:
其他好文 时间:
2014-05-23 11:31:51
阅读次数:
299
这道题本来思路并不复杂,先对第一列做binary search,
找到target所在的行,再对所在的行做binary
search,找到target在或不在。但是我在编程的时候遇到了很多问题,堆栈溢出(StackOverflowError)折腾死我了,一些边界条件的考虑也颇费周折。我之所以会碰到堆...
分类:
其他好文 时间:
2014-05-23 08:35:31
阅读次数:
294
1、
??
Balanced Binary Tree
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 subt...
分类:
其他好文 时间:
2014-05-23 08:19:19
阅读次数:
282
1、
??
Convert Sorted List to Binary Search Tree
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
分析:将一个升序排列的链表转换为平衡二叉搜索树,采用递归的方式,先找到链表...
分类:
其他好文 时间:
2014-05-22 12:33:30
阅读次数:
270
要运行J2EE的程序,就必须安装相关的容器,而如何选择JSP+Servlet模式。Tomcat是很重要的选择之一,是世界上最为广泛的Servlet和JSP容器。
下载:
1.
URL: http://tomcat.apache.org/ Tomcat 7.0.52
2.
单击左面”Tomcat 7.0”,进入Tomcat 7.0.52页面
3.
单击Binary Distri...
分类:
Web程序 时间:
2014-05-22 06:47:15
阅读次数:
295
戳我去解题Given an array where elements are sorted in
ascending order, convert it to a height balanced
BST.分析:因为BST中序序列是升序的,所以中序遍历序列最中间的元素一定是根节点,然后左右递归构建二叉...
分类:
其他好文 时间:
2014-05-20 11:38:16
阅读次数:
233
戳我去解题Given two binary strings, return their sum
(also a binary string).For example,a ="11"b
="1"Return"100".分析:高精度加法,只是将10进制的高精度加法 换成了 2进制的高精度加法首先将 两个...
分类:
其他好文 时间:
2014-05-20 11:21:52
阅读次数:
224
戳我去解题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 identic...
分类:
其他好文 时间:
2014-05-20 10:09:37
阅读次数:
201