RuntimeCmp.hpp#include using namespace std;// type for runtime sorting criterionclass RuntimeCmp {public: enum cmp_mode { normal, reverse };private...
分类:
编程语言 时间:
2015-10-26 12:13:56
阅读次数:
169
1: 3: 4: 5: 6: 7: {{th}} 8: 9: 10: 11: 12: {{row.a}} ...
分类:
Web程序 时间:
2015-10-14 12:17:55
阅读次数:
385
(referrence: GeeksforGeeks)Insertion sort is a simple sorting algorithm that works the way we sort playing cards in our hands.Algorithm// Sort an arr[...
分类:
其他好文 时间:
2015-10-06 10:16:08
阅读次数:
136
referrence: GeeksforGeeksBubble sortis the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong ord...
分类:
其他好文 时间:
2015-10-06 07:00:26
阅读次数:
175
SortSort1 SortSelect sort is the simplest sorting alogrithms.1.1 IDEA1.find the smallest element in the rest of array2.exchange the element with with ...
分类:
其他好文 时间:
2015-10-05 22:06:30
阅读次数:
284
DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smalle...
分类:
编程语言 时间:
2015-10-01 17:50:12
阅读次数:
247
I figured out a O(nlgn) solution, with a sorting. But yes, there are always smarter ones:https://leetcode.com/discuss/60830/solutions-explanation-spac...
分类:
其他好文 时间:
2015-09-29 14:33:25
阅读次数:
126
Problem DescriptionMatt’s friend K.Bro is an ACMer.Yesterday, K.Bro learnt an algorithm: Bubble sort. Bubble sort will compare each pair of adjacent i...
分类:
其他好文 时间:
2015-09-22 16:28:14
阅读次数:
272
poj 3270 Cow Sorting 简单的更换如果初始状态是a:2 3 1 5 4 6则目标状态为b:1 2 3 4 5 6且下标为初始状态中的3 1 2 4 5 6(a[3],a[1]...)将置换群写成循环的形式(2,3,1),(5,4),6就不用移动了。移动方式2种1:选循环内最小的数和...
分类:
其他好文 时间:
2015-09-22 16:27:53
阅读次数:
187
题意:给出m对关于n个字母的小于关系,输出通过这些关系能得到的结论,如果可以排序就输出至少知道第几个关系时就可以知道顺序,从小到大输出顺序;如果产生歧义就输出在第几个关系时出现歧义,如果不能得出准确的大小关系就输出无法排序。解法:拓扑排序。拓扑排序的大致流程就是先找入度为0的点,然后删去跟这个点相邻...
分类:
其他好文 时间:
2015-09-21 21:10:07
阅读次数:
169