
数据结构
c语言
王祺灏
耐得住寂寞 守得住芳华
展开
-
线性表(1)— “顺序表”
顺序表(1)——静态分配(数组) 相关操作(创销,增删查): #include <stdio.h> #include <stdlib.h> #define MaxSize 10 //顺序表定义类型(静态分配—数组) typedef struct { int data[MaxSize]; int length; }SqList; //初始化一个顺序表 void InitList(SqList &L){ L.length=0; } //顺序表插入元素 b原创 2021-09-17 21:56:26 · 86 阅读 · 0 评论 -
《数据结构》—“顺序表相关实验”
实验目标: 实验源码: #include <iostream> using namespace std; #define LIST_INIT_SIZE 100 #define INCREMENT 10 #define OVERFLOW -2 #define OK 1 #define ERROR 0 typedef int ElemType; typedef struct { ElemType *elem; int length; int listsize; }SqList;原创 2020-12-08 15:28:59 · 167 阅读 · 0 评论 -
《数据结构》—“链表的创建等相关操作”
链表的创建与遍历 源码 #include <iostream> using namespace std; //定义单链表类型 typedef int elemtype; typedef struct Lnode{ elemtype data; struct Lnode *next; }Lnode, * linklist; //创建一个链表 void createList_L(linklist &L,int n){ Lnode * p; L =原创 2020-12-03 11:23:23 · 157 阅读 · 0 评论