自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 python 爬楼梯

def climbStairs( n): previous, current = 0, 1 for i in range(n): prev, current = current, previous + current return currentif __name__ == '__main__': print(climbStairs(5))...

2019-08-26 17:41:12 170

原创 python 最短路径

G = {1: {1: 0, 2: 10, 4: 30, 5: 100}, 2: {2: 0, 3: 50}, 3: {3: 0, 5: 10}, 4: {3: 20, 4: 0, 5: 60}, 5: {5: 0}, }INF = 999999999dis = dict((key, INF) for key in G)start=1...

2019-08-21 21:44:37 874

原创 Python 实现二叉搜索树插入

# encoding: utf-8class Node: def __init__(self, data): self.data = data self.lchild = None self.rchild = Noneclass BST: def __init__(self, node_lists): sel...

2019-08-20 19:58:54 315

原创 python 缓存淘汰

class LRUcache: def __init__(self, size=5): self.cache = {} self.elems = [] self.size = size def get_data(self, elem): if elem in self.cache: self...

2019-08-15 13:31:03 125

原创 归并排序

def merge(a, b): c = [] h = j = 0 while j < len(a) and h < len(b): if a[j] < b[h]: c.append(a[j]) j += 1 else: c.append(b[h])...

2019-08-12 20:01:28 76

原创 用数组实现一个顺序栈

class Stack(object): def __init__(self): self.stack = [] def push(self, item): self.stack.append(item) def pop(self): return self.stack.pop() def peek(s...

2019-08-12 19:41:11 773

原创 Task 1:数组和链表

【数组】 实现一个支持动态扩容的数组实现一个大小固定的有序数组,支持动态增删改操作- 实现两个有序数组合并为一个有序数组- 学习哈希表思想,并完成leetcode上的两数之和(1)及Happy Number(202)!(要求全部用哈希思想实现!)class SortedArray: def __init__(self, capacity=15): "...

2019-08-09 22:15:50 80

空空如也

空空如也

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

TA关注的人

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