![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
听碎烟雨梦
这个作者很懒,什么都没留下…
展开
-
C++链队列(不带头结点)
不带头结点的链队列在初始化时首尾指针都指向空,其他思想和带头结点链队列类似 #include<iostream> using namespace std; typedef struct LinkNode{ int data; struct LinkNode *next; }LinkNode; typedef struct LinkQueue{ LinkNode *front,*rear; }LinkQueue; void InitQueue(LinkQueue &Q){原创 2022-05-28 18:20:25 · 228 阅读 · 0 评论 -
C++链队列(带头结点)
带头结点的链队列front指向表头结点,rear指向最后一个结点 #include<iostream> using namespace std; //结点 typedef struct LinkNode{ int data; struct LinkNode *next; }LinkNode; //链队列 typedef struct LinkQueue{ LinkNode *front,*rear; }; //初始化 void InitQueue(LinkQueue &am原创 2022-05-28 18:17:29 · 126 阅读 · 0 评论 -
C++循环队列
队列中前面的元素在出队之后仍然可以插入元素入队,此时需要达到循环,主要操作就是靠取余运算,达到循环队列的效果。 #include<iostream> #define MaxSize 10 using namespace std; typedef struct SqQueue{ int data[MaxSize]; int front,rear; }; //初始化 void InitSqQueue(SqQueue &Q){ Q.front = 0; Q.rear = 0原创 2022-05-28 18:13:40 · 1097 阅读 · 0 评论 -
C++顺序栈
#include<iostream> #define MaxSize 10 using namespace std; typedef struct{ int data[MaxSize]; int top; }SqStack; //初始化 void InitSqStack(SqStack &S){ S.top = -1; } //判空 bool StackEmpty(SqStack S){ if(S.top == -1) return true; else ret.原创 2022-05-22 20:46:15 · 95 阅读 · 0 评论 -
C++链栈(不带头结点)
#include<iostream> using namespace std; typedef struct StackNode{ int data; struct StackNode *next; }StackNode, *LinkStack; //初始化 bool InitLinkStack(LinkStack &S){ S = NULL; } //入栈 bool Push(LinkStack &S,int x){ StackNode *p = new .原创 2022-05-23 16:39:24 · 155 阅读 · 0 评论 -
C++单链表的基本实现(带头结点)
#include<iostream> #include<stdio.h> #include<stdlib.h> using namespace std; typedef struct LNode{ int data;//数据域 struct LNode *next;//指针域 }LNode, *LinkList; //初始化一个空的单链表 void InitList(LinkList &L){ L = new LNode; L->nex.原创 2022-05-16 21:17:30 · 279 阅读 · 0 评论 -
C++顺序表基本实现
#include<iostream> #include<stdio.h> #define InitSize 10 using namespace std; typedef struct{ int *data; int MaxSize; int length; }SqList; //初始化 void InitList(SqList &L){ L.data = new int[InitSize]; L.MaxSize = InitSize; L..原创 2022-05-14 10:28:11 · 192 阅读 · 0 评论