摘要:
cal_time.py import time def cal_time(func): def wrapper(*args, **kwargs): t1 = time.time() result = func(*args, **kwargs) t2 = time.time() print("%s r 阅读全文
摘要:
快速排序 def partition(li, left, right): tmp = li[left] while left < right: while left < right and li[right] >= tmp: #从右面找比tmp小的数 right -= 1 # 往左走一步 li[le 阅读全文
摘要:
冒泡排序 def bubble_sort(li): for i in range(len(li)-1): #第i趟 exchange = False for j in range(len(li)-i-1): if li[j] > li[j+1]: li[j], li[j+1] = li[j+1], 阅读全文
摘要:
阅读全文