数据结构
夜揽星辰
这个作者很懒,什么都没留下…
展开
-
顺序队列的基本操作出队,入队,插入
#include <iostream>#define MAXSIZE 7using namespace std;typedef struct{ int data[MAXSIZE]; int front,rear; }sqQueue; void InitQueue(sqQueue &Q){//初始化 Q.front = Q.rear = 0; }int QueueEmpty(sqQueue &Q){//判断为空 if(Q.front == Q.rea.原创 2021-12-20 11:37:29 · 1582 阅读 · 0 评论 -
栈的应用:十进制正整数转换为2进制、8进制、16进制
#include<iostream>#include<malloc.h>#define STACKINITSIZE 100#define STACKINCREMEMT 10using namespace std;typedef struct{ int *base;//动态存储空间的基地址,栈底 int *top;//栈顶指针,指向真实栈元素的下一个位置 int stacksize;}Sqstack;void InitStack(Sqstack .原创 2021-12-06 22:52:02 · 648 阅读 · 0 评论 -
S1和S2栈表合并到S3中去
#include<iostream>#include<malloc.h>#define STACKINITSIZE 100#define STACKINCREMEMT 10using namespace std;typedef struct{ int *base;//动态存储空间的基地址,栈底 int *top;//栈顶指针,指向真实栈元素的下一个位置 int stacksize;}Sqstack;void InitStack(Sqstack &原创 2021-11-21 20:26:27 · 199 阅读 · 2 评论 -
数据结构 顺序表La和Lb合并
#include <iostream>#include <malloc.h>#define LISTINCREMENT 10using namespace std;typedef struct{//线性表的动态分配顺序存储结构 int *elem;//存储空间基址 int length;//当前长度 int listsize;//当前地址 }SqList;void Init_L(SqList &L){//构造一个空的线性表 L.elem = (i原创 2021-10-24 15:39:25 · 4069 阅读 · 0 评论 -
栈的基本操作
#include<iostream>#include<malloc.h>#define STACKINITSIZE 100#define STACKINCREMEMT 10using namespace std;typedef struct{ int *base;//动态存储空间的基地址,栈底 int *top;//栈顶指针,指向真实栈元素的下一个位置 int stacksize;}Sqstack;void InitStack(Sqstack &原创 2021-11-21 19:51:37 · 268 阅读 · 0 评论 -
双向链表的基本操作:创建、构造、查找、删除、插入
#include <iostream>#include <malloc.h>using namespace std;typedef struct DuLNone{ int data; struct DuLNone *prior,*next;}DuLNone,*DuLinklist;void InitLink(DuLinklist &L){ L =new DuLNone; L->prior = NULL; L->next = L->prio原创 2021-10-31 20:22:54 · 118 阅读 · 0 评论 -
单链表基本操作:构造、赋值、查找、删除、遍历
#include<iostream>using namespace std;typedef struct LNone{ int data; struct LNone *next;}LNone,*Listnext;void InitList(Listnext &L){ L = new LNone; L->next = NULL;}void CreaterList(Listnext &L){ int n; Listne原创 2021-10-29 13:03:11 · 257 阅读 · 0 评论