Collection of algorithm for sorting
heap sort 堆排序
The heapsort algorithm can be divided into two parts.
In the first step, a heap is built out
of the data. The h...
分类:
其他好文 时间:
2014-09-19 19:24:45
阅读次数:
220
//ans=2*n+(n-1)(n-2) n>=2#include #include #include #include #include #include #include #include #include #include #include #include #include #include...
分类:
其他好文 时间:
2014-09-19 13:29:35
阅读次数:
188
D -Leapin' LizardsTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uDescriptionYour platoon of wandering lizards has entered a strange...
Problem地址:http://acm.hdu.edu.cn/showproblem.php?pid=1548一道简单的bfs,适合新手。你现在所在的电梯层为一个节点,而你从这个节点可以拜访另外两个节点(电梯向上走为一个节点,电梯向下走有一个节点),而拜访的时候自然也要避免拜访重复,否则会陷入死循...
分类:
其他好文 时间:
2014-09-17 23:08:12
阅读次数:
270
题目:n个叠放在一起的卡片,求使得他们同向的最小翻转次数,每次只能翻转最上面的k个。
分析:数学,贪心。每次翻转必然是不同情况(正,反)交接的地方(否则只会变得更糟);
记交接的地方的个数为m,那么翻转后交接的地方变为m-1或m;
(上面部分两端相同则为m-1,不同则为m)
因此一次翻转最多使得交接点减少1;所以每次翻...
分类:
其他好文 时间:
2014-09-16 12:44:30
阅读次数:
158
Collection of algorithm for sorting...
分类:
其他好文 时间:
2014-09-14 16:43:27
阅读次数:
210
农夫JOHN准备把他的 N(1 <= N <= 10,000)头牛排队以便于行动。因为脾气大的牛有可能会捣乱,JOHN想把牛按脾气的大小排序。每一头牛的脾气都是一个在1到100,000之间的整数并且没有两头牛的脾气值相同。在排序过程中,JOHN 可以交换任意两头牛的位置。因为脾气大的牛不好移动,JO...
分类:
其他好文 时间:
2014-09-14 15:22:57
阅读次数:
202
DNA Sorting
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 83069
Accepted: 33428
Description
One measure of ``unsortedness'' in a sequence is the number o...
分类:
其他好文 时间:
2014-09-14 00:12:10
阅读次数:
387
Sorting It All OutTime Limit: 1000msMemory Limit: 10000KBThis problem will be judged onPKU. Original ID:109464-bit integer IO format:%lld Java class n...
分类:
其他好文 时间:
2014-09-12 01:06:42
阅读次数:
178
Sorting It All Out
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 28055
Accepted: 9689
Description
An ascending sorted sequence of distinct values is one ...
分类:
其他好文 时间:
2014-09-11 21:00:22
阅读次数:
168