• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
ahnulxs
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

文章分类 -  常见数据结构

笔记 自己实现的几个常见数据结构
 
二叉搜索树
摘要:1 # encoding=utf-8 2 3 4 class BSTree: 5 """ 6 二叉搜索树 7 """ 8 middle_list = [] 9 10 class Node: 11 def __init__(self, ele): 12 self.data = ele 13 self. 阅读全文
posted @ 2020-12-23 22:39 ahnulxs 阅读(2) 评论(0) 推荐(0)
单链表
摘要:1 # encoding=utf-8 2 3 4 class SingleLinkList(object): 5 """ 6 单向链表, 各节点类型不限 7 """ 8 class Node(object): 9 """ 10 节点域, 存放ele & next 11 """ 12 def __in 阅读全文
posted @ 2020-12-23 22:36 ahnulxs 阅读(1) 评论(0) 推荐(0)
保存相同元素的栈, 初始化需指定长度与元素类型
摘要:1 # encoding=utf-8 2 3 4 class Stack: 5 """ 6 相同元素的栈, 初始化需指定长度与元素类型 7 """ 8 def __init__(self, size=25, _type=int): 9 """ 10 __size: the size of stack 阅读全文
posted @ 2020-12-23 22:34 ahnulxs 阅读(3) 评论(0) 推荐(0)
保存相同元素的队列, 初始化需指定长度与元素类型
摘要:1 # encoding=utf-8 2 3 class Queue: 4 """ 5 相同元素的队列, 初始化需指定长度与元素类型 6 """ 7 def __init__(self, size=25, _type=int): 8 """ 9 __size: the size of queue 1 阅读全文
posted @ 2020-12-23 22:32 ahnulxs 阅读(3) 评论(0) 推荐(0)
保存相同元素的数组, 扩展了四则运算
摘要:1 # encoding=utf-8 2 from __future__ import division 3 from collections import Iterable 4 5 6 class Array(Iterable): 7 """ 8 元素相同的列表 不用指定length 9 """ 阅读全文
posted @ 2020-12-23 22:29 ahnulxs 阅读(2) 评论(0) 推荐(0)
 

公告


博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3