mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 21:24:53 +08:00
Update bubble sort and insertion sort.
This commit is contained in:
@ -106,10 +106,10 @@ class QuickSortTailCall:
|
||||
# 对两个子数组中较短的那个执行快排
|
||||
if pivot - left < right - pivot:
|
||||
self.quick_sort(nums, left, pivot - 1) # 递归排序左子数组
|
||||
left = pivot + 1 # 剩余待排序区间为 [pivot + 1, right]
|
||||
left = pivot + 1 # 剩余未排序区间为 [pivot + 1, right]
|
||||
else:
|
||||
self.quick_sort(nums, pivot + 1, right) # 递归排序右子数组
|
||||
right = pivot - 1 # 剩余待排序区间为 [left, pivot - 1]
|
||||
right = pivot - 1 # 剩余未排序区间为 [left, pivot - 1]
|
||||
|
||||
|
||||
"""Driver Code"""
|
||||
|
||||
Reference in New Issue
Block a user