对 n个元素的数组进行排序,快速排序和归并排序的平均时间复杂度都为 <img src="https://img.julecn.com/tk/pla/fopnbhffbprxinzj.png" alt="" data-href="" style="">。但快速排序存在退化情况,使得时间复杂度升高至 <img src="https://img.julecn.com/tk/xnt/jqdhxvesleutzdui.png" alt="" data-href="" style="">;归并排序需要额外的空间开销。