介绍给大家一个快速排序的方法:
void sort(int a[ ], int l, int r)
{
int i = l;
int j = r;
int mid = a[(i+j)/2];
do
{
while(a[i]
while(a[j] >mid ) j--;
if( i
{
swap( a[i], a[j] );
}...
分类:
编程语言 时间:
2014-06-20 13:15:03
阅读次数:
292
数据结构 - 简单选择排序(simple selection sort)本文地址: http://blog.csdn.net/caroline_wendy/article/details/28601965 选择排序(selection sort) : 每一趟在n-i+1个记录中选取关键字最小的记录作为有序序列中第i个记录.简单选择排序(simple selection sort) : 通过n-i次关键字之间的比较, 从n-i+1个记录中选出关键字最...
分类:
编程语言 时间:
2014-06-20 09:48:25
阅读次数:
332
题目链接: here。题目描述: Sort a linked list using insertion
sort. 题目要求使用插入排序的方法来实现单链表的排序。插入排序是一种简单的排序,算法描述参考维基百科,或者《算法导论》。 下面是我实现的代码: 1 /**
2 Author:...
分类:
其他好文 时间:
2014-06-12 00:39:40
阅读次数:
284
count(*)是否能用到索引,用索引是高效还是低效select count(*) from
aa ;首先看是否会走索引,经过试验发现,他没有走索引它的执行计划 select statement sort aggregate table access
full别说是否高效了,他连索引都没有走,索引不...
分类:
其他好文 时间:
2014-06-11 12:00:01
阅读次数:
282
集合框架的工具类:collecttionsCollections 的方法全是静态的
List没有排序功能,所以java定义了Collections工具类。 比较器无法传给list,只能传给Set.但是集合工具类有此方法1.排序:
comparable: sort(List list) 根据元素的自然...
分类:
其他好文 时间:
2014-06-11 08:54:10
阅读次数:
218
Bubble sortBubble sort, sometimes incorrectly
referred to as sinking sort, is a simple sorting algorithm that works by
repeatedly stepping through the...
分类:
其他好文 时间:
2014-06-07 11:30:59
阅读次数:
390
STL实践与分析--容器特有的算法
与其它顺序容器所支持的操作相比,标准库为list容器定义了更精细的操作集合,使它不必仅仅依赖于泛型操作。当中非常大的一个原因就是list容器不是依照内存中的顺序进行布局的,不支持随即訪问,这样,在list容器上就不能使用随即訪问迭代器的算法,如sort等;还有其....
分类:
编程语言 时间:
2014-06-07 06:12:44
阅读次数:
245
1、ls基本语法及选项用法:ls [选项]... [文件]...List information
about the FILEs (the current directory by default).Sort entries alphabetically
if none of -cftuvSUX n...
分类:
其他好文 时间:
2014-06-06 14:11:26
阅读次数:
196
Sort a linked list using insertion sort./** *
Definition for singly-linked list. * struct ListNode { * int val; * ListNode
*next; * ListNo...
分类:
其他好文 时间:
2014-06-06 10:39:38
阅读次数:
212
Given an array withnobjects colored red, white
or blue, sort them so that objects of the same color are adjacent, with the
colors in the order red, wh...
分类:
其他好文 时间:
2014-06-05 17:49:43
阅读次数:
304