数据结构
Q183cm
这个作者很懒,什么都没留下…
展开
-
《数据结构》C语言版 队列之离散事件模拟
//离散事件模拟,模拟银行营业时的排队情况 //不考虑顾客中途离开,顾客到达事件随机,业务办理时间 //长度随机,选择最短的队排队,不再换队 #include <stdio.h> #include <time.h> #include <stdlib.h> #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 typedef int Status; typedef struct Event { //事件类转载 2020-08-17 22:41:31 · 634 阅读 · 0 评论 -
《数据结构》C语言版 链式队列的基本操作实现
#include "stdio.h" #include "stdlib.h" #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 #define OVERFLOW -1 typedef int QElemType; typedef int Status; typedef struct QNode { QElemType data;//数据域 struct QNode* next; }QNode, * QueuePtr;//结点类型原创 2020-08-17 22:25:32 · 504 阅读 · 0 评论 -
《数据结构》C语言版 循环队列的基本操作实现
#include "stdio.h" #include "stdlib.h" #define TRUE 1 #define ERROR 0 #define OK 1 #define FALSE 0 #define OVERFLOW -1 typedef int QElemType; typedef int Status; #define MAXQSIZE 100 typedef struct { QElemType* base; int front; int rear; }SqQueue; //原创 2020-08-17 22:11:27 · 710 阅读 · 0 评论 -
《数据结构》C语言版 栈的应用举例之迷宫求解
问题描述 源码如下: #include <stdio.h> // printf();scanf() #include <stdlib.h> // exit() #include <malloc.h> // malloc() #include <time.h> // srand((unsigned)time(NULL)); // 函数结果状态代码 #define TRUE 1 #define FALSE 0 #define OK 1原创 2020-08-17 02:24:29 · 546 阅读 · 2 评论 -
《数据结构》C语言版 栈的应用举例1
应用场景 数制转换 括号匹配的检查 行编辑程序 详情说明参考《数据结构(C语言版)》清华大学出版社严蔚敏编著 P48~P50 代码如下: /* run this program using the console pauser or add your own getch, system("pause") or input loop */ #include <stdio.h> // printf();scanf() #include <stdlib.h> // exit()原创 2020-08-16 20:14:15 · 679 阅读 · 0 评论 -
《数据结构》C语言版 栈的基本操作实现
严蔚敏数据结构C语言实现栈的基本操作 源码如下: #include<stdio.h> #include<stdlib.h> #define STACK_INIT_SIZE 100 #define STACKINCREMENT 10 #define OVERFLOW -1 #define OK 1 #define ERROR 0 typedef int Status; typedef int SElemType; typedef struct { SElemType* bas原创 2020-08-15 22:49:32 · 10539 阅读 · 1 评论 -
《数据结构》C语言版一元多项式的表示及相加
源码如下 #include<stdio.h> #include<stdlib.h> #define LEN sizeof(Poly) typedef struct term { float coef; //系数 int expn; //指数 struct term* next; }Poly, * Link; void CreatePolyn(Link* p, int m); void PrintPolyn(Link p); int cmp(Link p1, Lin原创 2020-08-15 16:59:27 · 5972 阅读 · 2 评论 -
《数据结构》C语言版 双向循环链表的基本操作实现
#include <stdio.h> #include <stdlib.h> // 双向循环链表的节点结构 typedef struct Node { int val; struct Node* prev; struct Node* next; } ListNode; // 显示菜单 void DisplayMenu() { printf("*************************\n"); printf("*[1]创建一个双向循原创 2020-08-15 16:24:08 · 329 阅读 · 0 评论 -
《数据结构》C语言版 静态链表的基本操作实现
#include <stdio.h> #define MAXSIZE 1000 #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 typedef int ElemType; typedef struct { ElemType data; int cur; }component, StaticLinkList[MAXSIZE]; // 初始化一个静态链表 void InitList(StaticLi原创 2020-08-12 11:20:46 · 214 阅读 · 0 评论 -
《数据结构》C语言版 静态链表的基本操作实现
#include <stdio.h> #define maxSize 7 typedef struct { char data; int cur; }component; //将结构体数组中所有分量链接到备用链表中 void reserveArr(component* array); //初始化静态链表 int initArr(component* array); //向链表中插入数据,body表示链表的头结点在数组中的位置,add表示插入元素的位置,a表示要插入的数据 void inser原创 2020-07-22 22:51:17 · 277 阅读 · 1 评论 -
《数据结构》C语言版 链表的基本操作实现
#include <stdio.h> #include <stdlib.h> #define ok 1 #define error -1 typedef int ElemType; typedef int Status; typedef struct Node { ElemType data; struct Node* next; }LNode, * LinkList; //构造空表 Status InitList(LinkList* L) { *L = (LinkLi原创 2020-07-21 00:17:52 · 379 阅读 · 0 评论 -
《数据结构》C语言版 顺序表的基本操作实现
#include <stdio.h> #include <stdlib.h> #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 #define OVERFLOW -1 #define LIST_INIT_SIZE 100 #define LISTINCREMENT 10 typedef int Status; typedef int ElemType; typedef struct { ElemType*原创 2020-07-16 21:50:44 · 628 阅读 · 0 评论