上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页
摘要: 如果数据量过大,超过最大的内存容量,那么一次性将所有数据读入内存进行排序是不可行的。例如,一个文件每一行存了一个整数,该文件大小为10GB,而内存大小只有512M,如何对这10GB的数据进行排序呢?外部排序就是为了解决这种问题的。思路: 外部排序的思路是,将超大文件分成若干部分,每一部分是可以读入... 阅读全文
posted @ 2014-08-28 22:28 米其林轮船 阅读(3415) 评论(0) 推荐(0) 编辑
摘要: #include#include#includestruct Node{ int key; Node *next; Node(int k) { key = k; next = NULL; }};void Insert(Node **phead... 阅读全文
posted @ 2014-08-26 21:48 米其林轮船 阅读(162) 评论(0) 推荐(0) 编辑
摘要: #include#include#includestruct Node{ int key; Node *next; Node(int k) { key = k; next = NULL; }};void Insert(Node **phead... 阅读全文
posted @ 2014-08-26 20:26 米其林轮船 阅读(136) 评论(0) 推荐(0) 编辑
摘要: #include#include#includevoid CountingSort(int *A,int len,int k){ int *B = new int[len]; //输出数组 memset(B,0,len*sizeof(int)); int *C = new int[... 阅读全文
posted @ 2014-08-26 19:22 米其林轮船 阅读(151) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#include#include#includevoid err_sys(const char *s){ printf("%s error:%s\n",s,strerror(errno)); exit(0);}bool isFind(cha... 阅读全文
posted @ 2014-08-25 21:08 米其林轮船 阅读(197) 评论(0) 推荐(0) 编辑
摘要: #includeint left(int i) //返回做儿子下标{ return (i=0;i--) { maxheapify(A,len,i); }}void heapsort(int *A,int len) //排序{ buildheap(A,len); ... 阅读全文
posted @ 2014-08-22 16:40 米其林轮船 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 甲乙用同一串数字玩游戏,一共15个,一开始这些数不是严格升序的,甲去掉一个数据,如果严格升序了,甲胜利,否则由乙继续去掉一个数据,如果严格升序了,乙胜利,否则再由甲删除数据,如此往复。通过15个初始数据,判断甲胜还是乙胜。#include#includeusing namespace std;boo... 阅读全文
posted @ 2014-08-21 17:08 米其林轮船 阅读(186) 评论(0) 推荐(0) 编辑
摘要: Given a infinite number of quarters(25cents), dimens(10cents), nickels(5cents) and pennies(1cent), write code to calculate the number of ways of repre... 阅读全文
posted @ 2014-08-21 11:24 米其林轮船 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Implement an algorithm to print all valid combinations of n-pairs of parentheses#includevoid f(int idx,int left,int right,char *buf){ if(left == 0 ... 阅读全文
posted @ 2014-08-21 11:17 米其林轮船 阅读(159) 评论(0) 推荐(0) 编辑
摘要: There is a building of 100 floors. If an egg drops from the Nth floor or above, it will break. If it's dropped from any floor below, it will not break... 阅读全文
posted @ 2014-08-20 10:53 米其林轮船 阅读(213) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页