冒泡排序
思想:先将最大的数放在组后一位,再递归子问题
实现方法:邻项冒泡
复杂度(O(n^2))
归并排序
思想:将序列分治,使分治后的子序列有序,再将子序列线性合并
复杂度(O(nlogn))
快速排序
思想:分治序列,选择一个基准数,将小于基准数的数字放在左侧,大于的放在右侧,分治到底层时序列即有序
复杂度平均(O(nlogn)),最劣(O(n^2))
内省排序
思想:防止快速排序退化到(O(n^2)),当递归深度超过(lfloor log_2n floor)时自动转化为堆排序,保证最劣复杂度是(O(nlogn))