Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.分析:我们比较熟悉由一个sorted array生成一个BST,不同的是这里的数据...
分类:
其他好文 时间:
2014-11-25 23:01:58
阅读次数:
213
Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni...
分类:
其他好文 时间:
2014-11-25 22:47:09
阅读次数:
163
Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the t...
分类:
其他好文 时间:
2014-11-25 22:47:02
阅读次数:
245
一个笨办法用两个Queue实现:/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; ...
分类:
其他好文 时间:
2014-11-25 17:52:34
阅读次数:
203
简单递归实现:/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ ...
分类:
其他好文 时间:
2014-11-25 17:47:04
阅读次数:
215
转自:http://lancui.iteye.com/blog/935578简介相比WebService,Hessian更简单、快捷。采用的是二进制RPC协议(Binary),因为采用的是二进制协议,所以它很适合于发送二进制数据。Hessian通常通过Web应用来提供服务,因此非常类似于WebSer...
分类:
编程语言 时间:
2014-11-25 16:22:01
阅读次数:
160
二叉查找树(Binary Search Tree)的遍历的方法有很多,通常使用的是递归的遍历,其便于理解,但是使用递归的话会造成程序运行的空间浪费,效率并不高。为此可以使用一个栈来模拟递归的过程,实现迭代版的二叉查找树的遍历。但是会使用到额外的存储空间,虽说在运行效率上比递归版的有所提高,但是额外的存储空间还是一定的浪费。但是如何减少额外的存储空间呢?我们知道二叉查找树是可以转换为一个双向环形链表...
分类:
其他好文 时间:
2014-11-25 14:39:21
阅读次数:
172
题目描述:
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree should look like...
分类:
其他好文 时间:
2014-11-25 12:49:09
阅读次数:
188
在VC下采用ADO实现BLOB(Binary)数据的存储,读取,修改,删除。作者:邵盛松 2009-09-05前言1关于的BLOB(Binary)数据的存储和读取功能主要参考了MSDN上的一篇《AppendChunk and GetChunk Methods Example (VC++)》,原文地址...
分类:
其他好文 时间:
2014-11-25 12:23:32
阅读次数:
166