- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 冒泡排序
# coding:utf-8 __author__ = 'taohao' """ bubble sort """ def bubble_sort(array): i = j = 0 length = len(array) while i < length-1: while j < length-i-1: if array[j] >
2015-03-15 10:59:14 365
原创 shell 排序
# coding:utf-8 __author__ = 'taohao' """ shell sort is improving the performance of the insert sort """ def shell_sort(array): gap = len(array)/2 while gap > 0: i = gap while
2015-03-14 18:35:45 496
原创 插入排序
# coding:utf-8 __author__ = 'taohao' """ insert sort """ def insert_sort(array): i = 1 while i < len(array): tem = array[i] j = i while tem 0: array[j] =
2015-03-14 18:19:35 422
原创 归并排序
# coding:utf-8 __author__ = 'taohao' """ merge sort use the extra space to exchange the time when merge two arrays, we need to use another empty array to store the completed array so the p
2015-03-14 17:12:20 445
原创 快速排序
def quick_sort(array, left, right): if left < right: # the if is necessary. only when left < right, the recursion can be handled i = left j = right tem = array[left]
2015-03-14 15:50:41 364
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人