数据结构——栈和队列
东呱QAQ
纯小白,努力学习ing
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【数据结构——栈和队列】链队的基本操作
typedef struct QNode{ int data; //数据域 struct QNode *next; //指针域}QNode;typedef struct{ QNode *front; //队头指针 QNode *rear; //队尾指针}LiQueue;//初始化void initQueue(LiQueue *&lqu){ lqu = (LiQueue *)malloc(sizeof(LiQueue)); lqu->front = lqu-&g原创 2021-12-09 20:00:56 · 488 阅读 · 2 评论 -
【数据结构——栈和队列】顺序队列的基本操作
typedef struct{ int data[maxSize]; int front; //队首指针 int rear; //队尾指针}SqQueue;//初始化void initQueue(SqQueue &qu){ qu.front = qu.rear = 0;}//判断队空int isQueueEmpty(SqQueue qu){ return qu.front == qu.rear;}//入队int enQueue(SqQueue &qu原创 2021-12-09 18:52:46 · 172 阅读 · 0 评论 -
【数据结构——栈和队列】链栈的基本操作
typedef struct LNode{ int data; struct LNode *next;}LNode;//链栈的初始化void initStack(LNode *&lst){ lst = (LNode *)malloc(sizeof(LNode)); lst->next = NULL; //结点申请后一定要指向空}//判断栈空int isEmpty(LNode *lst){ return lst->next = NULL;}//进栈voi原创 2021-12-09 18:42:41 · 139 阅读 · 0 评论 -
【数据结构——栈和队列】顺序栈的基本操作
typedef struct SqStack{ int data[maxSize]; int top;}SqStack;//顺序栈的初始化void initStack(SqStack &st){ st.top = -1;}//判断栈空int isEmpty(SqStack st){ return st.top == -1;}//进栈int push(SqStack &st, int x){ if(st.top == maxSize) return 0;原创 2021-12-09 18:25:32 · 162 阅读 · 0 评论 -
【数据结构——栈和队列】结构体定义
(1)顺序栈的定义typedef struct SqStack{ int data[maxSize]; int top;}SqStack;(2)链栈的定义typedef struct LNode{ int data; struct LNode *next;}LNode;(3)顺序队列的定义typedef struct{ int data[maxSize]; int front; //队首指针 int rear; //队尾指针}SqQueue;(4)链队定义1)原创 2021-12-09 18:05:23 · 907 阅读 · 0 评论
分享