前言:写了多年的程序,发现很多基本的算法的理论还是不很了解,最近特以重新学习基本的算法和数据结构。并配以Java实现。
一、关于排序的定义:
1. WIKI:排序算法是一种能将一串资料依照特定排序方式的一种算法。
2. Introduction to algorithms:
An algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output.
sorting problem:
Input: A sequence of n numbers 〈a1, a2, ..., an〉.
Output: A permutation (reordering)〈a'1, a'2, ..., a'n〉of the input sequence such that a'1<=a'2<=...... <=a'n.
3. Introduction to algorithms(中文版):
就是定义良好的 计算过程,它取一个或一组作为输入,并产生出一个或者一组作为输出。
4. 自我理解:
可以认为排序是把一个无序的数据序列通过一系列的操作变成一个有序的数据序列。
从信息熵的角度看是一个熵减的过程。
二、排序的分类:
分类 | 方法 | Average | Worst | Memory | Stable | Notes |
交換排序法 | 冒泡排序 | |||||
鸡尾酒排序 | ||||||
奇偶排序 | ||||||
Comb排序 | ||||||
Gnome排序 | ||||||
快速排序 | ||||||
选择排序法 | 选择排序 | |||||
堆排序 | ||||||
插入排序法 | 插入排序 | |||||
希尔排序 | ||||||
Tree排序 | ||||||
Library排序 | ||||||
Patience排序 | ||||||
归并排序法 | 归并排序 | |||||
Strand排序 | ||||||
非比較排序法 | 基数排序 | |||||
桶排序 | ||||||
计数排序 | ||||||
鸽巢排序 | ||||||
Burst排序 | ||||||
Bead排序 | ||||||
其他排序法 | 拓扑排序 | |||||
排序网络 | ||||||
Bitonic sorter | ||||||
Batcher odd-even mergesort | ||||||
Pancake sorting | ||||||
低效排序法 | Bogosort | |||||
Stooge sort | ||||||
新排序法 | 图书馆排序 |
Reference:http://en.wikipedia.org/wiki/Sorting_algorithm
三、算法实现(Java)