题目:
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted from left to right.The first integer ...
分类:
编程语言 时间:
2014-12-30 10:04:56
阅读次数:
196
Given a root of Binary Search Tree with unique value for each node. Remove the node with given value. If there is no such a node with given value in t...
分类:
其他好文 时间:
2014-12-30 08:08:42
阅读次数:
236
Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1.....
分类:
其他好文 时间:
2014-12-29 22:57:50
阅读次数:
205
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.解题思路:根据递增序列,求平衡二叉查找树,根据平衡二叉查找树的性质,其左右都是二叉查找树,用递归可以比较轻...
分类:
其他好文 时间:
2014-12-29 22:55:25
阅读次数:
297
Given a binary tree, return the preorder traversal of its nodes' values.
For example:
Given binary tree {1,#,2,3},
1
2
/
3
return [1,2,3].
Note: Recursive soluti...
分类:
其他好文 时间:
2014-12-29 21:34:20
阅读次数:
196
Given preorder and inorder traversal of a tree, construct the binary tree.这道题是要根据先序遍历和中序遍历构造出一棵二叉树,这道题和上一题是一样的。上一题不过是通过后序遍历和中序遍历构造一棵二叉树。只要将代码稍稍修改即可 1 ...
分类:
其他好文 时间:
2014-12-29 21:21:10
阅读次数:
377
Given inorder and postorder traversal of a tree, construct the binary tree.根据树的中序(左根右)和后序遍历(左右根)构造一棵二叉树参考:http://www.cnblogs.com/remlostime/archive/20...
分类:
其他好文 时间:
2014-12-29 21:14:33
阅读次数:
150
二分查找的前提的要查找的数组必须有序.代码如下:程序1 1 public class source { 2 3 public int binary_sort(int[] array, int item) { 4 int len = array.length; 5 ...
分类:
其他好文 时间:
2014-12-29 20:00:15
阅读次数:
215
04-1. Root of AVL Tree (25)
时间限制
100 ms
内存限制
65536 kB
代码长度限制
8000 B
判题程序
Standard
作者
CHEN, Yue
An AVL tree is a self-balancing binary sea...
分类:
其他好文 时间:
2014-12-29 18:28:43
阅读次数:
193
增量法最小圆覆盖....
Maple trees
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1646 Accepted Submission(s): 510
Problem Descript...
分类:
其他好文 时间:
2014-12-29 18:25:24
阅读次数:
131