![](https://img-blog.csdnimg.cn/20190918140158853.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
python数据结构与算法
文章平均质量分 79
python数据结构与算法
只因为你温柔
如果人生就是一场陷阱,不知何时才能到天明。如果对得起我的生命,我要向全世界证明。
展开
-
python链表
单项链表 class Node(object): """结点""" def __init__(self,elem): self.elem = elem # 数据域 self.next = None # 指针域 class SingleNode(object): """单链表""" def __init_...原创 2019-05-05 13:40:56 · 1043 阅读 · 6 评论 -
python栈与队列
栈的实现 class Stack(object): """栈""" def __init__(self): self.__item = [] def push(self,item): """添加一个新的元素item到栈顶""" self.__item.append(item) def p...原创 2019-05-05 13:43:57 · 511 阅读 · 1 评论 -
python排序算法
冒泡排序法 def bubble_sort(alist): """冒泡排序""" for j in range((len(alist)-1)): count = 0 for i in range((len(alist)-j-1)): if alist[i] > alist[i+1]: ...原创 2019-05-05 13:49:49 · 672 阅读 · 1 评论 -
python二叉树
树的添加 class Node(object): """结点""" def __init__(self, item): self.elem = item self.lchild = None self.rchild = None class Tree(object): """二叉树""" ...原创 2019-05-05 13:51:19 · 703 阅读 · 1 评论