自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(8)
  • 收藏
  • 关注

原创 归并排序(二路归并) Python实现

def Merge(nums, low, mid, high): res = [] i = low j = mid+1 while i<=mid and j<=high: if nums[i]<=nums[j]: res.append(nums[i]) i += 1 e...

2020-03-02 00:43:00 560 1

原创 堆排序(最大堆) Python实现

def AdjustUp(nums, k, n): #用于插入新值 i = 2*k temp = nums[k] while i>0 and nums[i]<temp: nums[k] = nums[i] k = i i /= 2 nums[k] = tempdef AdjustD...

2020-03-01 22:52:33 156

原创 简单选择排序 Python实现

def SelectSort(nums): n = len(nums) for i in range(0, n-1): min_pos = i for j in range(i+1, n): if nums[min_pos]>nums[j]: min_pos = j if ...

2020-03-01 19:05:09 141

原创 快速排序 Python实现

##nums is the list including numbers##def Partition(nums, left, right): privot = nums[left] while left<right: while left<right and nums[right]>=privot: right -= 1...

2020-03-01 17:58:58 67

原创 冒泡排序 Python实现

def BubbleSort(nums): n = len(nums) for i in range(n-1, 0, -1): for j in range(1, i+1): if nums[j]<nums[j-1]: temp = nums[j] nums[j] = nu...

2020-03-01 17:33:15 61

原创 希尔排序 Python实现

##nums is the list including numbers##def ShellSort(nums): n = len(nums) slide = n/2 while slide>=1: index = slide while index<n: if nums[index]<nums[...

2020-03-01 17:24:11 89

原创 折半插入排序 Python实现

##nums is the list including numbers##def BinaryInsertSort(nums): n = len(nums) if n<=1: return nums for i in range(1, n): if nums[i]<nums[i-1]: temp = n...

2020-03-01 00:28:11 387

原创 直接插入排序 Python实现

##nums is the list including numbers##def insertSort(nums): n = len(nums) if n<=1: return nums for i in range(1, n): if nums[i]<nums[i-1]: j = i - 1 ...

2020-02-29 23:40:20 159

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除