码迷,mamicode.com
首页 >  
搜索关键字:radix sort    ( 13156个结果)
poj 2549 --- 传说中的用“桶”防止HASH冲突
http://poj.org/problem?id=2549 维基百科有3Sum算法:https://en.wikipedia.org/wiki/3SUM sort(S); for i=0 to n-3 do a = S[i]; k = i+1; l = n-1; while (k<l) do b = S[k]; c = ...
分类:其他好文   时间:2014-08-11 21:23:53    阅读次数:356
lua 快速排序
function quick_sort(list, head, tail) if tail > head then i = head j = tail tmp = list[i] --取第一个元素用于比较 同时腾出第一个位置 while i i do if list[j] tmp then li.....
分类:其他好文   时间:2014-08-11 20:59:12    阅读次数:274
快速排序与递归
快速排序是一种效率比较高的算法,算法的思想是取出待排序中的一个元素,想办法将小于他的元素交换到他的左边,大于他的元素交换于他的右侧,然后对左右两侧再分别递归进行上述过程,直到左右两侧的元素只有一个。从而实现了整体的排序。c++实现的代码如下: //快速排序(递归) template void quick_sort(T *arr,int b,int e) { if(b<e) { ...
分类:其他好文   时间:2014-08-11 15:00:42    阅读次数:210
140809暑期培训
1、用sort对结构体中字符串进行二级排序 #include #include using namespace std; struct s { int d; char c[10]; }ss[15]; bool cmp(s a,s b) { if(strcmp(a.c,b.c)!=0) ...
分类:其他好文   时间:2014-08-11 06:19:01    阅读次数:171
vector
#include //从小到大排列#include#includeusing namespace std;int main(){ int i,x; vectormy ; for(i=1;i>x; my.push_back(x); } sort(my.begin(),my.end()); f...
分类:其他好文   时间:2014-08-10 18:34:30    阅读次数:188
Codeforces #259 Div.2
A. Little Pony and Crystal Mine 模拟题. 用矩阵直接构造或者直接根据关系输出 B. Little Pony and Sort by Shift 模拟题。 通过提供的操作得到的序列只能是两段递增或者整个序列递增。 那么可以求得第一段递增序列长度为0…p 如果整个序列是递...
分类:其他好文   时间:2014-08-10 18:31:40    阅读次数:206
sort排序
#include #includeusing namespace std;int main( ){ int i,a[10]; for(i=0;i>a[i] ; sort(a,a+10); for(i=0;i#includeusing namespace std;int main( ){ ...
分类:其他好文   时间:2014-08-10 18:27:00    阅读次数:216
sort函数
#include #includeusing namespace std;int a[5];int main( ){ int i; for(i=0;i>a[i] ; sort(a,a+5); for(i=0;i#includeusing namespace std;int a[5];boo...
分类:其他好文   时间:2014-08-10 18:24:00    阅读次数:199
poj2388
#include #include using namespace std;int main(){ int i,k,n,a[10000]; cin>>n; for(i=0;i>a[i]; sort(a,a+n); cout#include using name...
分类:其他好文   时间:2014-08-10 18:18:30    阅读次数:162
DSU
DSU stands for ‘decorate, sort, undecorate’ and refers to a pattern that is often useful for sorting lists according to some attribute of elements.For...
分类:其他好文   时间:2014-08-10 18:03:30    阅读次数:204
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!