码迷,mamicode.com
首页 >  
搜索关键字:sorting a three-valu    ( 709个结果
UVA Mapping the Swaps
题目如下: Mapping the Swaps  Sorting an array can be done by swapping certain pairs of adjacent entriesin the array. This is the fundamental technique used in the well-knownbubbl...
分类:移动开发   时间:2014-07-16 17:08:59    阅读次数:252
Cow Sorting hdu 2838
Cow SortingTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2224Accepted Submission(s): 701Problem ...
分类:其他好文   时间:2014-07-13 11:23:18    阅读次数:190
poj 2299 Ultra-QuickSort
Ultra-QuickSort Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 39436   Accepted: 14214 Description In this problem, you have to analyze a particular sorting...
分类:其他好文   时间:2014-07-11 08:30:42    阅读次数:264
C++: quick sort(快排序)
到目前为止, 我们已经学习到了插入排序, 冒泡排序, 选择排序(selection)。 这些排序算法都是comparision based sorting algorithms(即涉及到元素大小的比较来决定元素的先后顺序)。 而且算法的时间复杂度上均为O(n^2)。但是comparision based 的排序算法远非这几个算法。 而且可以通过利用其它的一些手段(例如divide and conq...
分类:编程语言   时间:2014-07-11 08:29:25    阅读次数:441
计数排序、基数排序与桶排序
一、计数排序 稳定、 当输入的元素是n 个小区间(0到k)内整数时,它的运行时间是 O(n + k),空间复杂度是O(n)。 const int K = 100; //计数排序:假设输入数据都属于一个小区间内的整数,可用于解决如年龄排序类的问题 //Input:A[0, ..., n-1], 0 <= A[i] < K //Output:B[0, ..., n-1], sorting of A...
分类:其他好文   时间:2014-07-08 21:24:36    阅读次数:232
选择问题(selection problem)
/* 本文是选择问题: 选择一组N个数当中的第k小的数(第k大的数类似) 集中方法的实现代码*/#include "sorting.h"#include "fatal.h"#define SORTING_BUBBLE1#define SORTING_INSERTION2#define SORTING...
分类:其他好文   时间:2014-07-07 15:22:12    阅读次数:222
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:选循环内最小的数和其他len-1个数交换 2:选整个序列最小的数和循环内最小的数交换,转到1,再换回来。 #include #inclu...
分类:其他好文   时间:2014-07-01 15:50:03    阅读次数:243
POJ3270 cow sorting 【polya】
题目描述: 给你一个数字序列(每个数字唯一),每次你可以交换任意两个数字,代价为这两个数字的和,问最少用多少代价能把这个序列按升序排列好。 题目的具体做法是参考刘汝佳的《算法艺术与信息学奥赛》大概思路是:以后再用别种方法解, 1.找出初始状态和目标状态。明显,目标状态就是排序后的状态。 2.画出置换群,在里面找循环。例如,数字是8 4 5 3 2 7 明显,               ...
分类:其他好文   时间:2014-06-28 08:07:33    阅读次数:183
POJ训练计划2299_Ultra-QuickSort(归并排序求逆序数)
Ultra-QuickSort Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 39279   Accepted: 14163 Description In this problem, you have to analyze a particular sorting...
分类:其他好文   时间:2014-06-22 15:38:06    阅读次数:168
USACO Section 2.1: Sorting a Three-Valued Sequence
简单题 1 /* 2 ID: leetcod3 3 PROG: sort3 4 LANG: C++ 5 */ 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include ...
分类:其他好文   时间:2014-06-16 09:51:21    阅读次数:162
709条   上一页 1 ... 67 68 69 70 71 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!