Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
分类:
其他好文 时间:
2014-07-03 18:55:48
阅读次数:
236
Given a binary tree, find its minimum depth.
分类:
其他好文 时间:
2014-07-03 18:54:32
阅读次数:
189
题目要求第n个丑数,所以对于中间结果不需要保存。
def Humble(index):
curHum = 1
M2 = 2; M3 = 3; M5 = 5
while index > 1:
curHum = min(min(M2, M3), M5)
while M2 <= curHum:
M2 *= 2
while M3 <= curHum:
M3 *= 3
w...
分类:
其他好文 时间:
2014-07-03 17:29:40
阅读次数:
214
前言
前一篇的文章介绍了通过建立索引来提高数据库的查询性能,这其实只是个开始。后续如果缺少适当的维护,你先前建立的索引甚至会成为拖累,成为数据库性能的下降的帮凶。
查找碎片
消除碎片可能是索引维护最常规的任务,微软官方给出的建议是当碎片等级为 5% - 30% 之间时采用 REORGANIZE 来“重整”索引,如果达到 30% 以上则使用 REBUILD 来“重建”索引。决定采用何种手段和操...
分类:
数据库 时间:
2014-07-03 16:08:50
阅读次数:
382
理解了Trie树然后就能1A 其实估计这个题随便做做就能A掉,可能不需要高级数据。
先贴吉林大学的代码模板
/*==================================================*| Trie树(k叉)
| INIT: init();
| 注: tree[i][tk]>0时表示单词存在, 当然也可赋予它更多含义;
\*=================...
分类:
其他好文 时间:
2014-07-03 13:42:21
阅读次数:
201
由于项目需要用到树状列表,可以增加成员变量,于是用了第三方RATreeView开元库,头一次使用,安装github上的使用说明和Demo跑了一下,挺满意,增加成员什么的都很简单,和tableview很像是,但是在处理选择的cell时我纠结了一会,用惯了tableview的index:index.row index.section等,猛然接触到RATreeView处理时,不知道该如何办了,下面记...
分类:
其他好文 时间:
2014-07-03 13:34:23
阅读次数:
216
Given a binary tree, find its maximum depth.
分类:
其他好文 时间:
2014-07-03 13:19:33
阅读次数:
251
Given a binary tree, flatten it to a linked list in-place.
分类:
其他好文 时间:
2014-07-03 13:10:52
阅读次数:
204
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.
分类:
其他好文 时间:
2014-07-03 13:02:23
阅读次数:
200
如果说数组(Array)是以线性的方式存储数据,那么可以将二叉树(Binary Tree)想象成以非线性二维的方式存储数据。二叉查找树(BST : Binary Search Tree)规定了树节点排列的一些规则,以保证它的查找时间要低于数组的线性查找时间。BST 算法查找时间依赖于树的拓扑结构,最...
分类:
其他好文 时间:
2014-07-03 12:14:51
阅读次数:
253