cpp数据结构
Moonpie.
Run, You clever boy!
展开
-
cpp 单链表基本操作
单链表的结构体 定义:#include <stdio.h>#include <malloc.h>typedef struct LNode{ int data; struct LNode* next;}LNode, * LinkList;//定义 * LinkList 的意义?单链表 头插法://单链表 头插法LinkList createTo...原创 2019-07-07 22:20:24 · 1978 阅读 · 0 评论 -
cpp 顺序表的基本操作
定义、初始化顺序表 ://定义、初始化顺序表#include <stdio.h>#define MaxSize 50//顺序表数组 静态分配typedef struct { int data[MaxSize]; int length;}SqList1;//顺序表数组 动态分配//动态分配语句:// L.data = typedef struct { in...原创 2019-07-06 20:58:26 · 408 阅读 · 0 评论 -
cpp栈的顺序存储结构
#include <stdio.h>#define MaxSize 50typedef struct { int data[MaxSize]; int top;}sqStack;//初始化void initStack(sqStack& S) { S.top = -1;}//判断栈空bool stackEmpty(sqStack S) { if (S.t...原创 2019-08-13 16:09:00 · 162 阅读 · 0 评论 -
cpp 链栈
链栈的基本操作原创 2019-08-13 19:21:11 · 159 阅读 · 0 评论 -
队列、循环队列
顺序队列的定义front指向队头元素rear指向队尾元素的下一个元素#include <stdio.h>#define MaxSize 50typedef struct { int data[MaxSize]; int front, rear;}sqQueue;顺序队列的队空条件:Q.front==Q.rear顺序队列 长度:Q.rear - Q...原创 2019-08-13 19:48:52 · 184 阅读 · 0 评论 -
cpp链队
初始化、判断队空:void initQueue(LinkQueue& Q) { Q.front = (LinkNode*)malloc(sizeof(LinkNode)); Q.rear = Q.front; Q.front->next = NULL;}bool isEmpty(LinkQueue Q) { if (Q.front == Q.rear...原创 2019-08-13 20:45:35 · 147 阅读 · 0 评论