首页
Python
Java
IOS
Andorid
NodeJS
JavaScript
HTML5
【
C_数据结构_数组
】的更多相关文章
C_数据结构_数组
//数组 # include <stdio.h> # include <malloc.h> //包含了 malloc 函数 # include <stdlib.h> //包含了 exit 函数 struct Arr //定义了一个叫struct Arr 的数据类型没有定义变量 { int * pBase; //存储的是数组第一个元素的地址 int len; //数组能容纳的元素的个数 int cnt; //当前数组的有效的元素的个数 }; void init_arr(s…
C_数据结构_数组的修改和删除
#include<stdio.h> typedef struct Node { int a,b; }node; node c[]; int n; void print() { int i; printf("\n当前数据:\n"); ;i<=n;i++) { printf("第%d组:a=%d,b=%d\n",i,c[i].a,c[i].b); } printf("\n\n"); }//输出 void setnum() { int…
c_数据结构_图_邻接表
课程设计------邻接表 图的遍历实现课程设计:https://files.cnblogs.com/files/Vera-y/图的遍历_课程设计.zip #include<stdio.h> #include<stdlib.h> #include<windows.h> #define OK 1 #define MAX_VERTEX_NUM 20 //最大顶点个数 //邻接表存储结构 typedef struct ArcNode { //邻接顶点信息链表 int adjv…
c_数据结构_哈希表
#include <stdio.h> #include <stdlib.h> #include <string.h> #define ERROR 0 #define OK 1 #define Size 21 // 指定质数(数组长度) typedef struct{ ]; ]; ]; }mul; typedef struct{ mul data[]; int size; }Hashtable; void init(Hashtable &h) { ;i<Si…
c_ 数据结构_图_邻接矩阵
程序主要实现了图的深度遍历和广度遍历. #include <stdio.h> #include <stdlib.h> #include <string.h> #define OVERFLOW -2 #define ERROR 0 #define OK 1 #define Length (q.rear+1)%QUEUE_MAXSIZE //队满 #define MAX_VERtEX_NUM 20 //顶点的最大个数 #define QUEUE_MAXSIZE 100 #d…
C_数据结构_链表的链式实现
传统的链表不能实现数据和链表的分离,一旦数据改变则链表就不能用了,就要重新开发. 如上说示:外层是Teacher,里面小的是node. #ifndef _MYLINKLIST_H_ #define _MYLINKLIST_H_ typedef void LinkList;//链表上下文,任意类型 typedef struct _tag_LinkListNode { struct _tag_LinkListNode* next;//包含下一个节点的地址 }LinkListNode;//节点 Lin…
c_数据结构_队的实现
# 链式存储#include<stdio.h> #include<stdlib.h> #define STACK_INIT_SIZE 100//存储空间初始分配量 #define STACKINCREMENT 10//存储空间分配增量 #define TURE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define OVERFLOW -2 typedef struct QNode{ int data; struct QNode…
c_数据结构_栈的实现
#include<stdio.h> #include<stdlib.h> #define STACK_INIT_SIZE 100 #define STACKINCREMENT 10 //stackincrement #define OVERFLOW -2 #define OK 1 #define ERROR 0 typedef struct{ int *base; int *top; int stacksize; }SqStack; //构建空栈 int InitStack(SqS…
c_数据结构_链表
#include<stdio.h> #include<stdlib.h> #define ERROR 0 #define OK 1 #define OVERFLOW -2 typedef struct Lnode{ int data; struct Lnode *next; }LNode,*LinkList; //初始化一个空指针 int InitList_L(LinkList &L){ L=(LNode *)malloc(sizeof(struct Lnode)); //…
c_数据结构_顺序表
#define OK 1 #define ERROR 0 #define OVERFLOW -2 #define LIST_INIT_SIZE 100 // 线性表存储空间的初始分配量 #define List_Increment 10 //线性表存储空间的分配增量 #include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct{ int *elem; //存储空间的基地址 int lengt…