数据结构
张洪睿
这个作者很懒,什么都没留下…
展开
-
栈的顺序存储——python
class SequenceStack(object): def __init__(self,size=10): self.max=size#最大容量 self.top=-1#top指针 self.s=[None]*self.max# 提前构建一个固定大小的栈,初始化全为None '''判断栈是否为空''' def is_...原创 2019-05-14 11:16:56 · 427 阅读 · 0 评论 -
顺序表——python
class SequenceList(object): '''顺序表(数组)''' def __init__(self,size=6): # 初始化顺序表 self.max=size#最大容量,默认为6 self.num=0#当前储存个数 # 提前构建一个固定大小的列表,初始化全为None self....原创 2019-05-10 11:28:49 · 298 阅读 · 0 评论 -
队列的链表存储——python
'''存在两个指针,类似于头指针和尾指针'''class Node(object): def __init__(self,item): self.item=item self.next=Noneclass LinkQueue(object): def __init__(self): n=Node(None) s...原创 2019-05-15 11:41:00 · 264 阅读 · 0 评论 -
单链表——python
class Node(object): def __init__(self,item): self.item=item self.next=Noneclass singlelist(object): def __init__(self): self._head=None def is_empty(self): return self._head is None...原创 2019-05-10 23:25:15 · 109 阅读 · 0 评论 -
双向链表——python
class Node(object): "双向链表节点" def __init__(self,item): self.item=item self.next=None #后 self.prev=None #前class doublelist(object): "双向链表" def __init__(self)...原创 2019-05-12 11:21:12 · 134 阅读 · 0 评论 -
单循环链表——python
class Node(object): "单循环链表节点" def __init__(self,item): self.item=item self.next=Noneclass singlecirclelist(object): """单循环链表""" def __init__(self): self._hea...原创 2019-05-12 12:40:51 · 416 阅读 · 0 评论 -
c++ 选择排序
#include <iostream>using namespace std;class select{private: int *arr;//数组 int chang;//长度 int temp; void show(int *aa, int length);//显示得内部功能实现 void selectSort(int *aa, int length);//从...原创 2019-06-21 18:40:42 · 219 阅读 · 0 评论 -
c++ 冒泡排序
#include <iostream>using namespace std;class maopao //类{private: int chang;//长 int *arr;//数组 int t;//交换数据会用到 void small_to_big(int *aa, int c);//从小到大排序 void big_to_small(int *aa, in...原创 2019-06-21 18:42:54 · 269 阅读 · 0 评论