Treap——大名鼎鼎的随机二叉查找树,以优异的性能和简单的实现在OIer们中广泛流传。 这篇blog介绍一种不需要旋转操作来维护的Treap,即无旋Treap,也称Fhq-Treap。 它的巧妙之处在于只需要分离和合并两种基本操作,就能实现任意的平衡树常用修改操作。 而不需要旋转的特性也使编写代码 ...
分类:
编程语言 时间:
2018-03-31 18:37:41
阅读次数:
1571
Given a matrix of size N x M. For each row the elements are sorted in ascending order, and for each column the elements are also sorted in ascending o ...
分类:
其他好文 时间:
2018-03-29 13:27:47
阅读次数:
135
原题链接: "https://leetcode.com/problems/kth largest element in an array/description/" 代码如下: ...
分类:
其他好文 时间:
2018-03-25 11:57:35
阅读次数:
175
Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. Note:Could you optimize your algorithm to us ...
分类:
其他好文 时间:
2018-03-25 10:36:39
阅读次数:
203
转自:http://linuxperf.com/?p=116 在Linux系统上,进程运行分为用户态与内核态,进入内核态之后使用的是内核栈,作为基本的安全机制,用户程序不能直接访问内核栈,所以尽管内核栈属于进程的地址空间,但与用户栈是分开的。Linux的内核栈大小是固定的,从2.6.32-520开始 ...
分类:
其他好文 时间:
2018-03-14 12:44:54
阅读次数:
270
传送门 觉得自底向上的splay贼神奇我竟然天真地写了自底向上,就不用kth了啊直接找到多好,然后发现我怕是个zz,我一reverse序号早乱了。。。 所以不能自底向上,至少我认为那是没有意义的。 然后就是取反的时候也是取异或,每次都会忘了这点。 //Achen #include<algorithm ...
分类:
其他好文 时间:
2018-03-10 12:05:36
阅读次数:
198
Question: Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note tha ...
分类:
其他好文 时间:
2018-03-09 12:13:59
阅读次数:
164
题目:Luogu 1486 一道平衡树入门题,把员工工资的增减转化成工资下界的增减就可以了。 不过写指针版平衡树的坑很多,注意 maintain( ) 当前节点和调用儿子节点的值前判断是否为 NULL。 代码第95行在调用 cur->size 前需判断。 ...
分类:
其他好文 时间:
2018-03-04 11:42:11
阅读次数:
157
树套树乱讲的代码 由于部分代码的完成时间较早所以码风可能有些差异,敬请谅解。 动态区间Kth [题面][1] [整体二分题解][2] [HNOI2016]网络 [题面][9] cpp include include include using namespace std; const int MAX ...
分类:
其他好文 时间:
2018-03-03 14:06:21
阅读次数:
217
阅读见https://www.zybuluo.com/ysner/note/1053583 普通平衡树 得了,平衡树的基本操作我怎么会自己写呢?详见http://www.cnblogs.com/cjyyb/p/7499020.html 文艺平衡树 功能:序列反转 原理:将区间[l,r]的端点l-1, ...
分类:
其他好文 时间:
2018-02-25 11:22:22
阅读次数:
222