A very interesting numeric problem. It involves a lot tricks.Linear search (by +\-) is not feasible - too slow. So binary search is a good idea. Also ...
分类:
其他好文 时间:
2014-07-29 14:02:08
阅读次数:
187
Problem DescriptionA tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by dire...
分类:
其他好文 时间:
2014-07-29 14:00:18
阅读次数:
255
查看二进制日志文件mysql> SHOW BINLOG EVENTS \G;mysql> SHOW MASTER LOGS;清除二进制日志文件mysql> PURGE { MASTER|BINARY } LOGS TO 'log_name';mysql> PURGE { MASTER|BINARY ...
分类:
数据库 时间:
2014-07-29 13:55:28
阅读次数:
318
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.题意:给定一个有序的链表,将其转换成平衡二叉搜索树思路: 二分法要构建一个平衡二叉...
分类:
其他好文 时间:
2014-07-29 13:40:48
阅读次数:
601
git在pull时,出现这种错误的时候,可能很多人进进行stash,相关stash的请看:Error
pulling origin: error: Your local changes to the following files would be overwritten by merge
但是发现stash后还是会出现:Error
pulling origin: error: The ...
The Utopian tree goes through 2 cycles of growth every year. The first growth cycle of the tree occurs during the monsoon, when it doubles in height. ...
分类:
其他好文 时间:
2014-07-29 11:57:26
阅读次数:
190
第13个位置第5个Bit :13>num[4] =>1 第四个bit 13-num[4]=5 :50 ,3-1 第三个Bit 5>num[2](3) 5-num[2]=2 ...#includeint num[45];void init(){ num[0]=1; num[1]=2; ...
分类:
其他好文 时间:
2014-07-29 11:50:46
阅读次数:
169
树是一类重要的非线性数据结构,是以分支关系定义的层次结构定义:树(tree)是n(n>=0)个结点的有限集T,其中: n=0时为空树 n>0时,有且仅有一个特定的结点,称为树的根(root) 当n>1时,其余结点可分为m(m>0)个互不相交的有限集T1,T2,……Tm, 其中每一个集...
分类:
其他好文 时间:
2014-07-29 10:44:46
阅读次数:
212
tree - 以树状图列出目录的内容:用途说明:tree命令以树状图列出文件目录结构。不过某些Linux上(Centos 6.4)没有tree命令,本文将介绍安装方法。常用参数:tree -d 只显示目录。tree -L 1 只显示第一层目录。[root@localhost tree-1.7.0]#...
分类:
系统相关 时间:
2014-07-29 10:33:36
阅读次数:
347
Prim算法的思想是,首先从任意一个节点出发,逐渐生成,直至该树覆盖了所有的V中的节点。
如下图:
图中的黑色的边即是最小生成树中的边。
实现Prim算法的关键便是,如何选择一条 “权值较小并且对于已有生成树中的点集合S来说是安全的边”,此处的安全指的是:
加入该边e之后,S仍然是一个树。
于是:对于图 G = (V, E) Prim的执行步骤大致为:
1 从任意节点r...
分类:
其他好文 时间:
2014-07-28 16:10:53
阅读次数:
205