![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C语言
王峰~
这个作者很懒,什么都没留下…
展开
-
【数据结构】-- 广度+深度遍历
#include<stdio.h>#include<stdlib.h> #define max 20//边表节点 typedef struct node{ int adjvex; struct node *next; }eNode;//头节点typedef struct headnode{ char vertex; eNode *firstedge;...原创 2019-12-10 13:56:11 · 126 阅读 · 0 评论 -
【数据结构】--中序-后序-先序遍历
#include <stdio.h>#include <stdlib.h>#include <time.h>//二叉树节点信息struct binarytreenode{ int data; struct binarytreenode *lchild;//左子树 struct binarytreenode *rchild;//右子树};...原创 2019-12-10 13:54:50 · 244 阅读 · 0 评论 -
【数据结构】 --层序遍历
#include <stdio.h>#include <stdlib.h>#define INITQUEUE 20//二叉树的层次遍历,层次遍历用到的数据结构是顺序队列typedef struct BiTNode{ char data;//节点数据 struct BiTNode *lchild;//节点左孩子指针 struct BiTNode *rchi...原创 2019-12-10 13:57:04 · 661 阅读 · 0 评论 -
【数据结构】--稀疏矩阵的三元组表示方式
//矩阵的三元组表示方式;#include<stdio.h>#define number 3//假设非零元的行下标的最大值为3; typedef struct { int i,j; int data;}triple;typedef struct { triple data[number];//非零元三元组表,data[0]未用; int...原创 2019-12-10 13:51:05 · 1911 阅读 · 0 评论 -
【数据结构】-- 稀疏矩阵的转置操作
#include<stdio.h>#define number 10typedef struct { int i,j; int data;}triple;typedef struct { triple data[number]; int n,m,num;}TSMatrix;TSMatrix transposeMatrix(TSMatri...原创 2019-12-10 13:50:26 · 477 阅读 · 0 评论 -
【数据结构】--顺序串
#include<stdio.h>#include<stdlib.h>#define MAXSIZE 100//串的顺序存储typedef struct st{ char *ch; //串存放的起始地址,串中第i个字符存储在ch[i-1]中 int length; //串的长度 int strsize; //分配的存储空间的大小...原创 2019-12-10 13:48:28 · 155 阅读 · 0 评论 -
【数据结构】 -- 顺序栈的入栈弹栈操作
#include<stdio.h>#include<stdlib.h>#define MAX 10typedef struct SqStack{ int data[MAX]; int top; }SqStack; //初始化栈 void InitStack(SqStack *s){ s->top=-1;}//判断栈是否为空 ...原创 2019-12-10 13:47:41 · 599 阅读 · 0 评论 -
【数据结构】 -- 链式队列的出入操作
#include <stdio.h>#include <stdlib.h>/* 队列遵循先进先出的原则; 1、过 top 指针直接找到队头节点,创建一个新指针 p 指向此即将出队的节点; 2、将 p 节点(即要出队的队头节点)从链表中摘除; 3、释放节点 p,回收其所占的内存空间;*/ typedef struct QNode{ int da...原创 2019-12-10 13:45:10 · 834 阅读 · 0 评论 -
【数据结构】 -- 链表的入栈弹栈
#include <stdio.h>#include <stdlib.h>//链表中的节点结构typedef struct lineStack{ int data; struct lineStack * next;}lineStack;//入栈操作; //stack为当前的链栈,a表示入栈元素lineStack* push(lineSt...原创 2019-12-10 13:43:30 · 540 阅读 · 0 评论 -
【数据结构】---线性链表结构
#include<stdio.h>#include<stdlib.h>#define MAX 20#define LISTINCREMENT 10typedef struct{ int *elem; int length; int listsize;}SqList;void CreatList(SqList &L){ //建立一个线性表...原创 2019-12-10 13:41:45 · 109 阅读 · 0 评论 -
【数据结构】--LineList -- 线性表顺序结构
#include<stdio.h>#define false 0#define ok 1#define maxsize 10//定义了线性表的结构typedef struct { int list1[maxsize]; int length;}sqlist;//初始化线性表int initlist(sqlist *l){ l->le...原创 2019-12-10 13:38:48 · 897 阅读 · 0 评论 -
【数据结构】-- 定义结构体数组
#include <stdio.h>#include <stdlib.h>// 定义结构体 typedef struct{ char *name; int age;}Student;// 结构体数组输入void inputStructArray(Student students[],int size){ int i=0; ...原创 2019-12-10 13:37:17 · 1030 阅读 · 0 评论