数据结构
Zzself
这个作者很懒,什么都没留下…
展开
-
顺序表的基本操作(C语言实现)
顺序表 定义: #include"stdio.h" typedef int DataType; #define MaxSize 6 typedef struct{ DataType data[MaxSzie]; int length; }SeList; 实现: 1.初始化顺序表 void InitSeList(SeList *p){ p->length=0; } 2.创建顺序表原创 2018-01-03 21:24:07 · 1072 阅读 · 0 评论 -
单链表的基本操作
定义:#include"stdio.h" typedef int DataType; typedef struct node{ DataType data; struct node *next; }ListNode;1.头插入法创建单链表ListNode *CrateListF(DataType *x,int n){ int i; ListNode *head,*s; head=NULL; fo原创 2018-01-03 22:28:12 · 232 阅读 · 0 评论 -
约瑟夫环——静态循环链表,动态循环链表
静态循环链表 struct node{ int flag; int next; }arr[11]; #include"stdio.h" #include"stdlib.h" #include"s.h" main(){ int i,j,k; for(i=0;i11;i++){ arr[i].flag =1; arr[i].nex原创 2018-01-04 22:01:52 · 480 阅读 · 0 评论 -
栈的基本操作
#define StackSize 6 typedef struct { int data[StackSize]; int top; }SeqStack; #include"stdio.h" #include"stdlib.h" #include"S.h" void InitStack(SeqStack *p){//初始化栈 p->top =-1; } int Emp原创 2018-01-05 22:15:21 · 184 阅读 · 0 评论 -
链栈的基本操作
定义 #define StackSize 6 //栈的元素个数 typedef struct node{//定义 int data; struct node *next; }StackNode; 实现代码 #include"stdio.h" #include"stdlib.h" #include"s.h" void InitStack(StackNode **p){//初原创 2018-01-06 15:45:56 · 414 阅读 · 0 评论 -
顺序队列的基本操作
定义 #define QueueSize 6 typedef struct {//定义 int data[QueueSize]; int fornt,real;//头指针,尾指针 }Queue; 实现 #include"stdio.h" #include"stdlib.h" #include"s.h" void InitQueue(Queue *p){//初始化队列原创 2018-01-06 16:09:48 · 812 阅读 · 0 评论 -
链队的基本操作
定义 #define QueueSize 6 typedef struct node{ int data; struct node *next; }QueueNode; typedef struct {//封装头尾指针 QueueNode *front; QueueNode *real; }Queue; 实现 #include"stdio.h" #in原创 2018-01-06 17:43:51 · 452 阅读 · 0 评论