很裸的最短路,不过节点数和边数都是1e6,直接dij肯定是不行了,稀疏图用heap优化一下就好o(╯□╰)o注意STL里面的优先队列是优先级大的(值大的)在前面的,一开始没注意WA了好几发,哎,太粗心了#include #include #include #include #include #inc...
分类:
其他好文 时间:
2014-07-22 22:54:33
阅读次数:
212
TCMalloc是什么?TCMalloc(Thread-CachingMalloc)与标准glibc库的malloc实现一样的功能,但是TCMalloc在效率和速度效率都比标准malloc高很多。TCMalloc是google-perftools工具中的一个(gperftools四个工具分别是:TCMalloc、heap-checker、heap-profiler和cpu-profiler),这..
分类:
数据库 时间:
2014-07-17 15:34:03
阅读次数:
421
很多人的解释都不一样, 我碰到的问题是,开辟的内存空间小于操作的内存空间.也就是说,我free的内存越界了.这是我开辟链表结构体内存的代码: 1 PNODE Create() { 2 int len; //total count of nodes to be created. 3 ...
分类:
移动开发 时间:
2014-07-17 09:57:34
阅读次数:
279
Java内存溢出详解一、常见的Java内存溢出有以下三种:1.java.lang.OutOfMemoryError: Java heap space----JVM Heap(堆)溢出JVM在启动的时候会自动设置JVM Heap的值,其初始空间(即-Xms)是物理内存的1/64,最大空间(-Xmx)不...
分类:
编程语言 时间:
2014-07-16 17:01:43
阅读次数:
304
这里记录下堆的相关操作。
op 1:
'''
@ data: the heap array
@ p : index of parent item
@ n : number of data
@@ Swap p and it's son items, make p the largest of them
'''
def swapForMaxHeap(data, n, p):
l...
分类:
其他好文 时间:
2014-07-13 17:07:15
阅读次数:
223
Exception in thread "HSQLDB Connection @429be9" java.lang.OutOfMemoryError: Java heap space
在服务器下的data/xxxx也就是数据库路径下,我的在F:\tomcat7\bin\data下删掉关于xxxx的文件及文件夹。...
分类:
数据库 时间:
2014-07-12 22:08:20
阅读次数:
338
Description
Read the statement of problem G for the definitions concerning trees. In the following we define the basic terminology of heaps. A heap is a tree whose internal nodes have each assigned...
分类:
其他好文 时间:
2014-07-12 18:52:12
阅读次数:
285
在堆排序之前我们要先知道一个非常基础的一个东西就是arr.heap-size。我刚开始看的时候,对这个不怎么重视,觉得,它不就是等于arr.length吗?并且在学习之初的建堆上,也没有多大的用处,但是在后面的排序中,优化性能方面它发挥了很大的作用。它的定义说白了就是在一个数组arr中有效的元素个数...
分类:
其他好文 时间:
2014-07-08 22:04:15
阅读次数:
208
堆数据结构是一种数组对象,它可以被视为一颗完全二叉树,树中每个节点和数组中存放该节点值的那个元 素对应。如果表示堆的数组为A,那么树的根为A[1]。
一、 堆
1. 表示堆的数组A是一个具有两个属性的对象:length(A)是数组中的元素个数,heap-size(A)是存放在A中的堆的元素个数;A[heap-size(A)]之后的元素都不属于相应的堆。也就是:Heap-size(A)。
2....
分类:
其他好文 时间:
2014-07-08 20:23:53
阅读次数:
222
??①push_heap算法以下是push_heap算法的实现细节。该函数接收两个迭代器,用来表现一个heap底部容器(vector)的头尾,而且新元素已经插入究竟部的最尾端。template inline void push_heap(RandomAccessIterator first,Rand...
分类:
其他好文 时间:
2014-07-08 00:22:55
阅读次数:
307