摘要: 1 import random 2 3 4 def quick_sort(nums, start, end): 5 if start >= end: 6 return 7 low = start 8 mid = nums[low] 9 high = end 10 while low < high: 11 while low < high and mid <= nums[high]: 12 high 阅读全文
posted @ 2019-10-24 10:06 yixiu868 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 1 import random 2 3 4 # 原始冒泡排序 5 def bubble_sort(nums): 6 counter = 0 7 for i in range(len(nums) - 1): # 这个循环负责设置冒泡排序的趟数 8 for j in range(len(nums) - i - 1): # 这个是每趟比较的次数,每次从0开始,底部是已有序 9 if nums[j] > 阅读全文
posted @ 2019-10-24 09:59 yixiu868 阅读(203) 评论(0) 推荐(0) 编辑