收藏强迫症
这个就是资料~
1. 开着翻译看教程,实例教程,有分析有图
https://pythonprogramming.net/
2. 用github看算法导论
3. Jupyter Notebook版的Tensorflow教程
https://github.com/sjchoi86/Tensorflow-101
4. Deep Learning Tutorials电脑带不动,就先留着喽
https://github.com/sjchoi86/Deep-Learning-101
无聊写代码
好好补补基础,今天就是归并没并上来...反思一下写代码
# MergeSort 归并
def mergeSort(arr):
mid = len(arr)/2
left ,right = arr[:mid],arr[mid:]
if len(left)>1:
left = mergeSort(left)
if len(right)>1:
right = mergeSort(right)
res = []
while left and right:
if left[0]>=right[0]:
res.append(left.pop())
else:
res.append(right.pop())
res.reverse()
return (left or right)+res
arr = [4,1,2,7,6]
print mergeSort(arr)
# 快排
def quickSort(arr):
if len(arr)<=1:return arr
low,pi,high = partition(arr)
return quickSort(low)+[pi]+quickSort(high)
# 分区
def partition(arr):
pi , arr = arr[0],arr[1:]
low = [x for x in arr if x<=pi]
high = [x for x in arr if x>pi]
return low,pi,high
print quickSort(arr)