- 博客(5)
- 收藏
- 关注
原创 队列C++链表的实现方式(队列--数据结构)
队列C++链表的实现方式(队列–数据结构) 1.队列的结构 struct Node { ElementType Data; struct Node *Next; }; struct QNode { Node *rear; Node *front; }; typedef struct QNode *Queue; Queue PtrQ; 2.出队操作 ElementType DeleteQ(Queue PtrQ) { struct Node *FrontCell;
2021-01-21 09:43:43
238
原创 队列的C++数组实现方法(队列--数据结构)
队列的C++实现方法(队列–数据结构) 1.队列结构 #define MaxSize //储存数据元素的最大个数 struct QNode { ElementType Data[MaxSize]; int rear; int front; }; typedef struct QNode *Queue; 2.入队列 void AddQ(Queue PtrQ, ElementType item) { if((PtrQ->rear+1)%MaxSize==Ptr->fr
2021-01-20 17:00:25
244
原创 堆栈C++链表实现方法(堆栈--数据结构)
堆栈C++链表实现方法(堆栈–链表) 需注意链表表头作为链表顶端 1.链表结构 typedef struct SNode *Stack; struct SNode { ElementType Data; struct SNode *Next; }; 2.堆栈初始化(生成空栈) Stack CreateStack() { Stack S; S=(Stack)malloc(sizeof(SNode)); S->Next = NULL; return S; }
2021-01-20 16:13:39
435
原创 堆栈C++使用数组实现(堆栈--数据结构)
堆栈C++实现 1. 堆栈的数组存储实现 堆栈的结构 1.1 push操作 1.先判断堆栈是否为满 2.再push元素入栈 #define MaxSize //堆栈的最大储存量 typedef struct SNode *stack; struct SNode { ElementType Data[MaxSize]; int top; //指向堆栈顶部 } void Push(Stack Ptrs,ElementType item) { if(Ptrs->Top==Maxs
2021-01-20 12:09:11
1021
原创 双向链表两个结点互换位置(链表--数据结构)
双向链表两个结点互换位置(链表–数据结构) 双向链表两个结点互换位置 /*struct Node { int value; Node *next; Node *prev; };*/ /*交换 buffer 和 i 两个结点(buffer在i右端)i---->buffer */ Node *temp; if (buffer->next == NULL)//buffer为链表结尾 { buffer->next = i; buffer->
2021-01-19 13:48:15
5089
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人