Basic plan for in-place sort.
a.Create max-heap with all N keys.
b.Repeatedly remove the maximum key.
Procesure
#include
#include
int N=11;
char a[]={' ','S','E','E','L','M','O','P','R','S','T','...
分类:
其他好文 时间:
2014-12-26 09:42:19
阅读次数:
186
go语言也自己的容器数据结构。主要有list、heap和ringpackage mainimport ( "container/heap" "fmt" "sort" // "strconv")type HeapInt []intfunc (h HeapInt) Len() i...
分类:
其他好文 时间:
2014-12-25 17:54:40
阅读次数:
162
安装
apt-get install valgrind
测试程序
#include
#include
int*Test(void)
{
int* x = malloc(10 * sizeof(int));
delete x;// problem 1: heap block overrun, problem 2: memory leak --x not free, ...
分类:
其他好文 时间:
2014-12-25 16:29:15
阅读次数:
118
原文地址:http://developer.51cto.com/art/201112/305696.htm1、OOM for Heap=>例如:java.lang.OutOfMemoryError: Java heap space分 析:此OOM是由于JVM中heap的最大值不满足需要,将设置hea...
分类:
编程语言 时间:
2014-12-24 21:27:39
阅读次数:
189
1.当使用String str="abc",这种方式时,先去内存的Heap中找是否存在"abc"这个字符串,若存在,则将地址引用。若不存在则创建。2.当使用String str=new String("abc");时,不管事先是否存在"abc",每次都会创建其新的对象。测试一下: String s1...
分类:
其他好文 时间:
2014-12-24 11:34:18
阅读次数:
130
priority_queue的用法
priority_queue调用 STL里面的 make_heap(), pop_heap(), push_heap() 算法实现,也算是堆的另外一种形式。先写一个用 STL 里面堆算法实现的与真正的STL里面的 priority_queue用法相似的priority_queue, 以加深对 priority_queue 的理解
#include...
分类:
其他好文 时间:
2014-12-22 09:35:35
阅读次数:
188
好久没有写了,不是忘了,也不是懒,是因为迷茫了~~不知道该学什么,该写什么,该走什么样子的路,该做什么样子的人。我嘴笨,不知道怎么把自己会的讲给别人,我愿意分享,所以我就写出来,不管是对的,错的,希望大家能取其精华去其糟粕,不要因为我而误导诸位。废话不多说了~~
你的应用内存泄漏了么?
要看是不是存在内存泄漏,首先我们要看到内存信息,如何看到内存信息呢?这里介绍一种方法,打开Eclipse...
分类:
移动开发 时间:
2014-12-20 23:32:30
阅读次数:
428
运行时 触发了virsual studio的assert断点。输出内容如下:HEAP[xx.exe]: Invalid Address specified to RtlValidateHeap( 00C80000, 00CACFFC )Windows 已在 xx.exe 中触发一个断点。其原因可能是...
分类:
其他好文 时间:
2014-12-20 18:12:35
阅读次数:
218
Merge k Sorted ListsMergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.多路归并。1、用make_heap函数维护一个大小为k的最小堆。注:...
分类:
其他好文 时间:
2014-12-20 11:34:12
阅读次数:
163
use smaller heap/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next...
分类:
其他好文 时间:
2014-12-18 23:31:27
阅读次数:
235