平衡二叉树(Balanced Binary Tree)是二叉查找树的一个进化体,也是第一个引入平衡概念的二叉树。1962年,G.M. Adelson-Velsky 和 E.M. Landis发明了这棵树,所以它又叫AVL树。平衡二叉树要求对于每一个节点来说,它的左右子树的高度之差不能超过1,如果插入...
分类:
其他好文 时间:
2015-09-10 20:57:26
阅读次数:
247
称号:Maple treesTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 177 Accepted Submission(s): 63Probl...
分类:
其他好文 时间:
2015-09-10 17:21:13
阅读次数:
161
题目:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), retu...
分类:
其他好文 时间:
2015-09-10 12:39:35
阅读次数:
102
最近在做项目时,需要把binary类型数据转换成字符类型的数据,发现原来可以这样写,记录下来供需要的童靴参考。IF OBJECT_ID('fn_BinaryToChar') IS NOT NULL DROP FUNCTION fn_BinaryToCharGO/* =================...
分类:
其他好文 时间:
2015-09-10 11:10:10
阅读次数:
198
Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tre...
分类:
其他好文 时间:
2015-09-10 00:21:23
阅读次数:
178
一.题目描述 The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total number of bits in the code, print the...
分类:
其他好文 时间:
2015-09-09 23:00:04
阅读次数:
422
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 given sum.Fo...
分类:
其他好文 时间:
2015-09-09 21:22:44
阅读次数:
168
问题:鉴于二叉搜索树。有两个节点不小心换位置,现在,我们需要修改。它不改变树的结构。分析:二叉排序树的遍历是有序。所以这个问题是建立在序模板的问题,所以我们可以先序,并配有pre指针指向当前遍历结果中的最后一个结点,即下次遍历前的前一个结点。然后就能够通过将当前结点与pre结点进行比較。来推断是否有...
分类:
其他好文 时间:
2015-09-09 19:24:38
阅读次数:
107
Gray CodeThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the tot...
分类:
其他好文 时间:
2015-09-09 18:56:08
阅读次数:
114
题目描述:For a given sorted array (ascending order) and atargetnumber, find the first index of this number inO(log n)time complexity.If the target number ...
分类:
其他好文 时间:
2015-09-09 16:21:30
阅读次数:
195