归并排序(merge sort)是一个时间复杂度为O(nlogn)的基于比较的排序算法(comparison based sorting algorithm)。 归并排序大多数实现(implementation)都将其实现成了一个stable sort, 所谓的stable sort的意思就是the implementation preserves the input order of equal...
分类:
编程语言 时间:
2014-07-28 15:55:43
阅读次数:
392
Greg A. writes,I enjoyed your post on how to not sort by average rating. I was wondering if you have any experience with sorting based on average vote...
分类:
其他好文 时间:
2014-07-28 15:13:13
阅读次数:
261
题目:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order r....
分类:
编程语言 时间:
2014-07-28 11:34:20
阅读次数:
297
之间介绍插入排序时漏掉一种插入方式,那就是折半插入。
这种方式是采用二分查找法去查找插入点,可以减少元素比较次数,但是并不能减少移动次数,复杂度跟直接插入一样,都为O(n^2).
直接上代码:
//二分插入排序
void binary_insert_sort(int arr[],int len)
{
if(arr == NULL || len <= 1)
{
return;
}...
分类:
其他好文 时间:
2014-07-28 00:27:19
阅读次数:
292
java希尔排序算法 代码下载地址:http://www.zuidaima.com/share/1550463279090688.htm...
分类:
编程语言 时间:
2014-07-28 00:21:49
阅读次数:
248
出自http://blog.csdn.net/ajun_studio/article/details/6698147 和http://www.oschina.net/question/12_18065?sort=time
Redis 是一个高性能的key-value数据库。 redis的出现,很大程度补偿了memcached这类keyvalue存储的不足,在部 分场合可以对关系数据库起到很好...
分类:
系统相关 时间:
2014-07-28 00:13:29
阅读次数:
598
DescriptionBeing a programmer, you like arrays a lot. For your birthday, your friends have given you an arrayaconsisting ofndistinctintegers.Unfortuna...
分类:
其他好文 时间:
2014-07-27 22:27:19
阅读次数:
219
基数排序又叫卡片排序,这是在比较早的时候用的比较多的排序方法。
在现代计算机出现之前,一直用于老式穿孔卡的排序。
说下基数排序的思想,前面我有写一个桶式排序,基数排序的思想是桶式排序的推广。
桶式排序:http://blog.csdn.net/alps1992/article/details/38132593...
分类:
编程语言 时间:
2014-07-27 11:51:53
阅读次数:
257
#SIZE 10
//直接插入排序
void insert_sort(){
int i,j;
int array[SIZE+1];
array[]={0,12,23,11,55,2,34,18,20,48,22};
for(i=2;i
array[0]=...
分类:
其他好文 时间:
2014-07-27 11:11:32
阅读次数:
238
Codeforces Round #258 (Div. 2) B. Sort the Array(简单题)...
分类:
其他好文 时间:
2014-07-26 15:21:53
阅读次数:
200