
数据结构
无
Xiaoweidumpb
达到理想不太易。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
c语言-栈的应用
#include"SeqStack.h" void print(SeqStack *s){ for (int i = 0; i < s->top; i++) { printf("%4c",s->base[i]); } printf("\n"); } void main(){ SeqStack st; IniStack(&st); char ch=getchar(); while(ch!=原创 2020-11-28 17:15:58 · 231 阅读 · 0 评论 -
c语言-二叉树-非递归PostOrder
#include<stdio.h> #include<malloc.h> #include<assert.h> #include"Stack.h" #define ElemType char typedef struct BinTreeNode { ElemType data; struct BinTreeNode *leftChild; struct BinTreeNode *rightChild; }BinTreeNode; typedef struct原创 2020-12-06 10:47:58 · 226 阅读 · 0 评论 -
数据结构课程设计c语言运动会管理系统
参加运动会的有n个学院,学校编号为1……n,比赛分成m个男子项目,和w个女子项目。项目编号为男子1……m,女子m+1……m+w。不同的项目取前八名积分,且前八名的积分分别为:9、7、6、5、4、3、2、1(m<=20,n<=20)。 功能要求:(1)可以输入各个项目的前八名的成绩;(2)能统计各学院的总分并排序;(3)可以按学院编号、学院总分、男女团体总分排序输出;(4)可以按学院编号查询学院某个项目的情况;可以按项目编号查询取得前八名的学院。(5)可以查找汇总某名选手参加的项目和获取的名次和积原创 2021-01-08 18:22:29 · 12379 阅读 · 9 评论 -
串的模式匹配算法
int StrIndex(SString S, SString T, int pos) { int i = pos; int j = 0; while(S[i]!='\0' && T[j]!='\0') { if(S[i] == T[j]) { i++; j++; } else { i = i-j+1; j = 0; } } if(T[j] == '\0') return i-j; return -1; } void Str原创 2020-12-01 21:42:29 · 167 阅读 · 0 评论 -
c语言-孩子兄弟树的实现
#pragma once #include<stdio.h> #include<malloc.h> #include<assert.h> #define ElemType char typedef struct TreeNode { ElemType data; struct TreeNode *firstChild; //����㿴�� ��Ϊ���ӣ���Ϊ�ֵ� struct TreeNode *nextSibling; }Tr原创 2020-12-11 09:24:47 · 277 阅读 · 0 评论 -
c语言-广义表
#pragma once //防止重复编译 #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> #define AtomType int typedef enum { HEAD, ATOM, CHILDLIST } ElemTag; typedef struct GLNode { ElemTag tag; //标记原创 2020-12-04 18:39:19 · 241 阅读 · 0 评论 -
c语言单链表实现
头文件 #ifndef __SLIST_H__ #define __SLIST_H__ #include<stdio.h> #include<malloc.h> #include<assert.h> #define ElemType int typedef struct Node { ElemType data ; struct Node *next; }Node,*PNode; typedef struct List{ PNode原创 2020-11-25 10:02:19 · 132 阅读 · 0 评论 -
c语言 字符型二维数组传参
初始化定义 vscode虽然报错 但编译运行没有问题. 调用函数 函数实现原创 2021-01-04 19:43:56 · 630 阅读 · 0 评论 -
c语言-链栈
head #ifndef __LINKSTACK_H__ #define __LINKSTACK_H__ #include<stdio.h> #include<stdlib.h> #include<assert.h> #define ElemType int typedef struct StackNode{ ElemType data; struct StackNode *next; }StackNode; typedef StackNo原创 2020-11-27 20:55:08 · 144 阅读 · 0 评论 -
c语言二叉树
main #include"BinTree.h" //ABC##DE##F##G#H## void main() { char *VLR = "ABCDEFGH"; char *LVR = "CBEDFAGH"; char *LRV = "CEFDBHGA"; int n = strlen(VLR); BinTree mytree; InitBinTree(&mytree,'#'); CreateBinTree_5(&mytree,VLR,LVR,n); B原创 2020-12-05 19:37:54 · 438 阅读 · 0 评论 -
c语言-顺序栈
头文件 #ifndef __SEQSTACK_H__ #define __SEQSTACK_H__ #include<stdio.h> #include<malloc.h> #include<assert.h> #define ElemType int #define STACK_INIT_SIZE 8 #define STACK_INC_SIZE 3 typedef struct SeqStack { ElemType *base; int c原创 2020-11-27 20:00:04 · 142 阅读 · 0 评论 -
c语言-串结构顺序存储
#include"SString.h" void main(){ SString S; InitString(S); SString T; InitString(T); StrAssign(S,"abcdefghi"); StrAssign(T,"xyz"); StrInsert(S,1,T); // int res=StrCompare(S,T); // printf("%d",res); // SStrin原创 2020-12-01 16:45:36 · 247 阅读 · 0 评论 -
c语言静态链表
头文件 #ifndef __STATICLIST_H__ #define __STATICLIST_H__ #include<stdio.h> #define MAX_SIZE 20 #define ElemType char typedef struct ListNode { ElemType data; int cur; }ListNode; typedef ListNode StaticList[MAX_SIZE]; int Malloc_SL(StaticList原创 2020-11-26 17:00:29 · 207 阅读 · 0 评论 -
c语言串结构之堆分配
#ifndef __HSTRING_H__ #define __HSTRING_H__ #include<stdio.h> #include<malloc.h> #include<assert.h> #include<string.h> typedef struct HString { char *ch; int length; }HString; void InitString(HString *S); void PrintString(HSt原创 2020-12-01 17:43:38 · 205 阅读 · 0 评论 -
c语言线性表之顺序表实现
头文件 //避免重复编译 #ifndef __SEQLIST_H__ #define __SEQLIST_H__ #include<stdio.h> #include<malloc.h> #include<assert.h> #define SEQLIST_INIT_SIZE 8 #define INC_SIZE 3 typedef int ElmeType; typedef struct SeqList { ElmeType *base; int cap原创 2020-11-23 21:52:14 · 206 阅读 · 0 评论 -
c语言-根据前序中序还原二叉树
//////////////////////////////////////////////////////////////// //5 void CreateBinTree_5(BinTree *bt, char *VLR, char *LVR, int n) { CreateBinTree_5(bt->root,VLR,LVR,n); } void CreateBinTree_5(BinTreeNode *&t, char *VLR, char *LVR, int n) { if(n原创 2020-12-06 17:33:22 · 761 阅读 · 0 评论 -
c语言-循环队列
#include"SeqQueue.h" void IniQueue(Queue *Q){ Q->base=(ElemType *)malloc(sizeof(ElemType) * MAXSIZE); assert(Q->base!=NULL); Q->front=Q->rear=0; } void EnQueue(Queue *Q,ElemType x){ if(((Q->rear+1)%MAXSIZE)==Q->front原创 2020-11-29 11:14:10 · 157 阅读 · 0 评论 -
c语言-串的压缩存储和快速转置
#ifndef _SPARSEMATRIX_H #define _SPARSEMATRIX_H #include<stdio.h> #include<memory.h> #include<stdlib.h> #include<assert.h> #define ElemType int #define MAXSIZE 100 typedef struct Tripe { int i; int j; ElemType e; }Tripe原创 2020-12-02 12:10:36 · 177 阅读 · 0 评论 -
顺序表c语言
#include<stdio.h> #include<stdlib.h> #define MAXSIZE 100 typedef int elemtype; typedef struct //定义线性表的结构 { elemtype data[MAXSIZE]; int length; }SqList; /* 线性表初始化:Init_List(L) 初始条件:表L不存在 操作结果:构造一个空的线性表 */ SqList *Init_SeqList(){ SqList *L;原创 2020-10-02 17:31:17 · 435 阅读 · 0 评论 -
c语言-顺序队列
#include"SeqQueue.h" void main(){ Queue Q; IniQueue(&Q); ElemType v; for(int i=1;i<=5;++i){ EnQueue(&Q,i); } ShowQueue(&Q); DeQueue(&Q); ShowQueue(&Q); GetHead(&Q,&v); prin原创 2020-11-29 10:48:20 · 268 阅读 · 0 评论 -
c语言单循环链表
头文件 #ifndef __SCLIST_H__ #define __SCLIST_H__ #include<stdio.h> #include<stdlib.h> #include<assert.h> #define ElemType int typedef struct Node { ElemType data; struct Node *next; }Node,*PNode; typedef struct List { PN原创 2020-11-27 14:17:39 · 168 阅读 · 0 评论 -
c语言-链队列
// LinkQueue.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<stdio.h> #include<malloc.h> #include<assert.h> #define ElemType int typedef struct QueueNode{ ElemType data; struct Queue原创 2020-11-28 20:00:48 · 172 阅读 · 0 评论 -
c语言-邻接矩阵-数组表示
#pragma once #include<stdio.h> #include<malloc.h> #include<assert.h> #define Default_Vertex_Size 10 #define T char typedef struct GraphMtx { int MaxVertices; //最大的定点数 int NumVertices; //顶点数 int NumEdges; //边数 T *V原创 2020-12-14 22:14:18 · 230 阅读 · 0 评论 -
单链表头插法c语言
#include <stdio.h> #include <stdlib.h> typedef int ElemType; typedef struct Node{ ElemType data; struct Node *next; }LinkNode,*LinkList; /* p: pointer q: next character of p,another pointer */ LinkList Creat_LinkList( ) //头插入法建立单链表算法 { Lin原创 2020-10-03 09:34:04 · 1698 阅读 · 0 评论 -
c语言-线索二叉树
#include"ThreadBinTree.h" void InitBinTree(BinTree *bt,ElemType ref){ bt->root=NULL; bt->refvalue=ref; } BinTreeNode* _Buynode(ElemType x){ BinTreeNode *s=(BinTreeNode*)malloc(sizeof(BinTreeNode)); assert(s!=NULL); s->data=x原创 2020-12-07 22:57:40 · 133 阅读 · 0 评论