You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
使用 parttion 函数,将数组中的第一个元素置于正确的顺序位置(左边元素比他小,右边大于等于),对基点左右的队列递归进行快速排序。快排的终止条件,左右界相等,则返回左界或右界。partition 函数:x 为第一个元素,小于 x 左边,大于等于 x 右边,左边初始数组 [-1,0),右边初始数组[0,0], i 从位置 1 开始遍历,若小于 x,和右边数组的第一位置换,左右边数组向后移动一位。
O(n*log(2,n))
归并排序
对左边进行归并排序,得到数组 left,对右边进行归并排序,得到结果 right,合并 left 和 right,结束条件,进行归并排序到数组长度为 1 时,返回原数组,归并是一种外部排序。
O(n*log(2,n))
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: