前言
RMQ: 数组 a0, a1, a2,..., an-1, 中求任意区间 a[i+1], a[i+2], ..., a[i+k] 的最小值
LCA: 求二叉树中两个节点的最低公共祖先
本文将证明这两个问题可以相互归约为另一个问题。
证明
先通过一个简单的例子来说明问题。见下图:
求 [7 2 8 6] 的最小值...
分类:
其他好文 时间:
2014-07-22 23:01:35
阅读次数:
271
QUE:线段树?称谓:从刘汝佳的书中得知,“这种数据结构在学术界没有统一的术语,但线段树是最常见的叫法。其他叫法包括区间树(interval
tree)、范围树(range
tree)等,但这些属于在特定的场合(如计算几何)中有着特殊的意义”。怎么叫看读者的心情,以下统一用线段树称呼。先来作一些了解...
分类:
其他好文 时间:
2014-05-02 16:21:56
阅读次数:
347
>>> for i in range(0,10):if i >
10:break;else:print "hello world";输出:hello world>>> for i in
range(0,10):if i > 5:break;else:print "hello world";没有输出-...
分类:
编程语言 时间:
2014-05-01 21:13:53
阅读次数:
368
atan2 definitionIn terms of the
standardarctanfunction, whose range is(?π/2, π/2), it can be expressed as
follows:Notes:This produces results in the r...
分类:
其他好文 时间:
2014-05-01 09:51:23
阅读次数:
435
思路来源:http://blog.csdn.net/sf____/article/details/24626739题目给出数据上限为200,
所以可以暴利所有区间。解题思路:for i in range(n): for j in range(n): create priority_queue...
分类:
其他好文 时间:
2014-04-29 19:11:37
阅读次数:
526
UITextView上如何加上类似于UITextField的placeholder呢,其实在UITextView上加上一个UILabel,然后再实现
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text这个代理方法就可以了。
...
分类:
移动开发 时间:
2014-04-29 13:42:21
阅读次数:
337
jQuery 滑动改变价格演示 XML/HTML Codesection id="content" > div class="cube"> div class="a">div> div class="b">div> div class="c">div> div class="d">div> div id="slider-range-min">div> div> input type...
分类:
Web程序 时间:
2014-04-29 13:27:21
阅读次数:
595
今天正式开始学习html5了,相比html以前的版本,html5新增了好多功能,属性,使我们做出来的界面更加的绚丽,而且使用起来超级简单,这篇文章先来说说html增加的那些input类型和属性。
html5新增的input类型有:email,url,number,range,date pickers,datalist,telephone,search,color
email:提交时会自...
分类:
Web程序 时间:
2014-04-27 18:31:48
阅读次数:
1273