C语言-数据结构
文章平均质量分 72
小怪丶
学无止境
展开
-
C语言-数据结构-单链表倒置
/*#include #include //单链表倒置typedef struct node{ int data; struct node *next;}body;body *table(){ int i,a; body *head,*p1,*p2; head=NULL; for(i=0;;i++)原创 2017-05-23 21:30:52 · 3198 阅读 · 0 评论 -
C语言-数据结构-线性表检索和二分检索
#include #include #define maxsize 100typedef int datatype;typedef struct{ datatype data[maxsize]; ///数组 int len; ///线性表长度}seqlist;///顺序查找int seqsearch1(seqlist l,datatype原创 2017-05-25 17:56:12 · 661 阅读 · 0 评论 -
C语言-数据结构-prim算法求最小生成树
#include #include #include "ljjz.h"typedef struct edgedata{ int beg,en; int length;}edge;void peim(Mgraph g,edge tree[M-1]){ edge x; int d,min,j,k,s,v; for(v=1;v原创 2017-05-25 17:54:58 · 2210 阅读 · 0 评论 -
C语言-数据结构-克鲁斯卡尔kruskal
#include #include //#include "ljjz.h"//求解最小生成树算法typedef struct edgedata{ int beg,en;///边顶点序号 int length;///边的权值长}edge;///对边向量快速排序///边向量edges边向量左右下标left rightvoid QuickSort(原创 2017-05-25 17:54:03 · 487 阅读 · 0 评论 -
C语言-数据结构-图的遍历
#include #include #include "ljb.h"int visited[M];///图的遍历void dfs(linkedgraph g,int i){ edgenode *p; printf("visit vertex:%c\n",g.adjivex[i].vertex); visited[i]=1; p=g.a原创 2017-05-25 17:52:47 · 1248 阅读 · 0 评论 -
C语言-数据结构-二叉树
#include #include /*结点的度:结点拥有的子女数树的度:树中所有结点度的最大值叶子结点(终端结点):度为0的结点树枝:树中连续两个结点的线段路径:路径的长度等于所经过的树枝条数树的深度(高度):树中结点的最大层数一颗非空二叉树的第i层上至多有(2的(i-1)次方)个结点(i>=1)满二叉树:结点个数为2的h-1方完全二叉树:最后一层均向原创 2017-05-25 17:51:31 · 394 阅读 · 0 评论 -
C语言-数据结构-树
#include #include /*树的遍历1.树的前序遍历先访问跟结点,在从左到右2.树的后序遍历先从左到右,在访问跟结点3.层次遍历左到右*////前序void preoder(tree p){ int i; if(p!=NULL) { printf("%c",p->data);原创 2017-05-25 17:50:04 · 383 阅读 · 0 评论 -
C语言-数据结构-插入
#include #include struct node{ int date; struct node *next;};struct node* creattable(int n)///n节点个数{ int i,a; struct node *head,*p1,*p2; head = NULL; ///头结点为空原创 2017-05-24 23:17:24 · 765 阅读 · 0 评论 -
C语言-数据结构-链串插入删除链接
#include #include ///链串插入和删除和连接///adc mn dfetypedef char datatype;typedef struct node{ datatype data; struct node *next;}node;typedef node *linkstr;///创建字符串void creates原创 2017-05-24 23:11:57 · 1861 阅读 · 0 评论 -
C语言-数据结构-链栈
#include #include int text(char *t,char *p){ int i=0,j=0,k=0; while(i { k=1; while(j { if(t[i]==p[i+j]) j++;原创 2017-05-24 23:10:31 · 279 阅读 · 0 评论 -
C语言-数据结构-创建栈
#include #include #define maxsize 100///创建栈typedef int data;typedef struct{ data *base; //栈底 data *top; //栈顶 int stacksize; //栈大小}stack;//创建栈(初始化)void init(stack *s)原创 2017-05-24 23:09:13 · 11006 阅读 · 3 评论 -
C语言-数据结构-双链表插入查找
#include #include ///双链表typedef int datatype;typedef struct node{ datatype data; struct node *prior,*next;}body;body *table(){ int i; body *head,*p,*s,*end; pr原创 2017-05-24 23:06:52 · 369 阅读 · 0 评论 -
双链表
#include #include typedef struct node{ int data; struct node *prior,*next;}body;body *table(int n){ int i; body *p,*head,*s; head=(body *)malloc(sizeof (body));原创 2017-05-23 21:51:10 · 218 阅读 · 0 评论 -
C语言-数据结构-结点链表
#include #include //顺序结构void myinsert(int *a,int n){ int i,num,ipos; printf("please inputs num or ipos:"); scanf("%d,%d",num,ipos); if(ipos>n||ipos { printf("原创 2017-05-18 18:36:40 · 424 阅读 · 0 评论 -
C语言-数据结构-链表删除
#include #include struct node{ int date; struct node *next;};struct node *table(int n){ int i,a; struct node *head,*p1,*p2; head=NULL; for(i=n;i>0;i--) {原创 2017-05-18 18:39:55 · 448 阅读 · 0 评论 -
C语言-数据结构-排序
#include #include #define maxsize 100typedef int datatype;typedef struct{ datatype num; char name[20]; float china; float math; float english;}recordtype;typedef原创 2017-05-25 17:57:51 · 340 阅读 · 0 评论