基础的排序算法,平均时间复杂度为O(n^2),包括选择排序,插入排序,冒泡排序等。
一般用的排序算法,平均时间复杂度为O(nlogn),包括归并排序,堆排序,快速排序,希尔排序等。
以及一些特殊情况下能用的排序算法,计数排序,桶排序,基数排序等。
排序的稳定性指的是值相同的元素排序后是否相对位置发生变化,a,c,b,如果a=b,排序结束b在a前面,那么就是不稳定的。
比如我们对一批对象的某个成员进行排序,有时候不想改变该成员值相等的相对顺序。
排序的排序方式指的是待排序的数据是否需要全部放置在内存中,当要排的数据非常大的时候,我们只能选择外部排序,整个排序过程能够在内外存之间多次交换数据进行。