Sorting is one of the most usedoperations in real life, where Computer Science comes into act. It iswell-known that the lower bound of swap based sorting is nlog(n).It means that the best possible sor...
分类:
其他好文 时间:
2014-09-01 10:50:23
阅读次数:
234
效果图 部分less代码 @pinet-screen-width:?2880;
.mixin-sorting(@bg)?{
????&.sorting_1?{
????????background-color:?@bg;
????????color:?#3d8dc6;
????????a?{
????...
分类:
Web程序 时间:
2014-08-31 15:57:01
阅读次数:
886
Sorting It All Out
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 27929
Accepted: 9655
Description
An ascending sorted sequence of distinct values is on...
分类:
其他好文 时间:
2014-08-26 19:40:46
阅读次数:
194
链接:http://poj.org/problem?id=1094
题意&思路:直接拓扑排序。多解输出一串英文,有环输出一段英文,唯一解输出一段英文及排序结果。
细节:题目描述不是很清楚,如果不看discuss我肯定要WA出翔。
discuss里总结了两点关键的:
1. 输入一条边时如果此时拓扑有解就输出这个解,即使后面的边成有向环也不管了,所以每次输入的时候都得进行拓扑排序。...
分类:
其他好文 时间:
2014-08-25 22:58:15
阅读次数:
279
大致题意:排列多个DNA序列,按照每个序列的“有序程度”。如果一个序列已经按照字母顺序排好了,那么这个序列有序程度最高,如AACCGGTT。反之,如果一个序列越无序,那么它的有序程度越低,如TGTCAA。
解题思路:计算每个序列的“逆序数”,即反序字母对的个数,如ATGC的逆序数是3,因为TG,TC,GC都是逆序的。然后按照每个序列的逆序数排序,逆序数越大说明这个序列越无序。
#include...
分类:
其他好文 时间:
2014-08-21 17:16:54
阅读次数:
160
Selection:selection is a trivial problem if the input numbers are sorted. If we use a sorting algorithm having O(nlgn) worst case running time, then t...
分类:
其他好文 时间:
2014-08-19 04:50:43
阅读次数:
200
排序算法(Sorting algorithm):将一串数据依照特定排序方式进行排列的一种算法...
分类:
编程语言 时间:
2014-08-18 20:37:23
阅读次数:
366
题目链接
题意:给出n个数,求出得到最大数和第二大数所用的最多的比较次数
思路:可以取两个数两两做比较,就相当与建立二叉树,两个数的最大值就相当与两个的父节点,所以我们我们可以知道得到最大值时的比较次数为n-1,然后假设所有左儿子都大于右儿子,所以最大值的右儿子还有跟左子树中的值做比较得到第二大数,比较的个数为树高。
代码:
#include
#include
...
分类:
其他好文 时间:
2014-08-17 22:53:13
阅读次数:
224
刘汝佳 算法入门 第一版 Uva题目集合(四)...
分类:
其他好文 时间:
2014-08-17 10:28:12
阅读次数:
294