- 博客(23)
- 收藏
- 关注
原创 实现广义表的相关运算算法(一)
/*exp8-3.cpp*/#include #include typedef char ElemType;typedef struct lnode{ int tag;/*结点类型标识*/ union { ElemType data; struct lnode *sublist; }val; struct lnode *link;/*指向下一个元
2013-02-21 11:15:00 956
原创 实现广义表求表头和表尾的运算
/*algo8-2.cpp*/#include #include typedef char ElemType;typedef struct lnode{ int tag;/*结点类型标识*/ union { ElemType data; struct lnode *sublist; }val; struct lnode *link;/*指向下一个
2013-02-20 15:18:13 6839 2
原创 实现广义表的各种基本运算算法
/*algo8-1.cpp*/#include #include typedef char ElemType;typedef struct lnode{ int tag;/*结点类型标识*/ union { ElemType data; struct lnode *sublist; }val; struct lnode *link;/*指向
2013-02-20 14:44:40 3805
原创 实现英文单词按字典序排列的基数排序算法
/*exp11-10.cpp*/#include #include #include #define MaxLen 9/*单词的最大长度*/#define Radix 27/*基数Radix为27,分别对应'','a',...'z'*/typedef char String[MaxLen+1];/*定义String为字符数组类型*/typedef struct node
2013-02-17 12:38:12 4931
原创 实现基数排序算法
/*exp11-8.cpp*/#include #include #include #define MAXE 20/*线性表中最多元素个数*/#define MAXR 10/*基数的最大取值*/#define MAXD 8/*关键字倍数的最大取值*/typedef struct node{ char data[MAXD];/*记录的关键字定义的字符串*/ s
2013-02-15 16:02:15 580
原创 实现二路归并排序算法
/*exp11-7.cpp*/#include #include #define MAXE 20/*线性表中最多元素个数*/typedef int KeyType;typedef char InfoType[10];typedef struct/*记录类型*/{ KeyType key;/*关键字项*/ InfoType data;/*其他数据项,类型为Info
2013-02-15 13:47:49 1239
原创 实现直接选择排序算法
/*exp1-5.cpp*/#include #define MAXE 20/*线性表中最多元素个数*/typedef int KeyType;typedef char InfoType[10];typedef struct/*记录型*/{ KeyType key;/*关键字项*/ InfoType data;/*其他数据项,类型为InfoType*/}RecT
2013-02-12 13:01:30 584
原创 实现快速排序算法
/*exp11-4*/#include #define MAXE 20/*线性表中最多元素个数*/typedef int KeyType;typedef char InfoType[10];typedef struct /*记录类型*/{ KeyType key;/*关键字项*/ InfoType data;/*其他数据项,类型为InfoType*/}RecTy
2013-02-12 12:34:23 408
原创 实现冒泡排序算法
/*exp11-3*/#include #define MAXE 20 /*线性表中最多元素个数*/typedef int KeyType;typedef char InfoType[10];typedef struct /*记录类型*/{ KeyType key;/*关键字项*/ InfoType data;/*其他数据项,类型为InfoType*/}RecT
2013-02-11 15:05:02 531
原创 实现希尔插入排序算法
/*exp11-2*/#include #define MAXE 20/*线性表中最多元素个数*/typedef int KeyType;typedef char InfoType[10];typedef struct{ KeyType key;/*记录类型*/ InfoType data;/*其他数据项,类型为InfoType*/}RecType;void
2013-02-11 14:46:27 744
原创 实现直接插入排序算法
/*exp11-1.cpp*/#include #define MAXE 20/*线性表中最多元素个数*/typedef int KeyType;typedef char InfoType[10];typedef struct{ KeyType key;/*记录类型*/ InfoType data;/*其他数据项,类型为InfoType*/}RecType;
2013-02-07 14:40:45 1218
原创 统计一个字符串中出现的字符及其次数
/*exp10-5.cpp*/#include #include #include #define MAXWORD 100typedef struct tnode{ char ch;/*字符*/ int count;/*出现次数*/ struct tnode *lchild,*rchild;}BTree;void CreaTree(BTree * &p,
2013-02-07 13:54:40 2624
原创 实现二叉排序树的基本运算算法
/*exp10-4.cpp*/#include #include #define MaxSize 100typedef int KeyType;typedef char InfoType;/*定义关键字类型*/typedef struct node /*记录类型*/{ KeyType key;/*关键字项*/ InfoType data; /*其他数据域*/
2013-02-07 13:40:47 2812
原创 !用二叉树来表示代数表达式
/*exp7-7.cpp*/#include #include #include #define MaxSize 100typedef char ElemType;typedef struct node{ ElemType data;/*数据元素*/ struct node *lchild;/*指向左孩子*/ struct node *rchild;/*指向
2013-02-06 11:19:50 2980
原创 构造哈夫曼树
/*exp7-6.cpp*/#include #include #define N 50/*叶子结点数*/#define M 2*N-1/*树中结点总数*/typedef struct{ char data[5];/*结点数*/ int weight;/*权重*/ int parent;/*双亲结点*/ int lchild;/*左孩子结点*/ int
2013-02-06 10:59:25 1107
原创 实现中序线索化二叉树
/*exp7-5.cpp*/#include#include#define MaxSize 100typedef char ElemType;typedef struct node{ ElemType data; int ltag,rtag;/*增加的线索标记*/ struct node *lchild; struct node *rchild;}TBT
2013-02-05 16:48:51 850
原创 由遍历序列构造二叉树
/*exp7-4.cpp*/#include#include#define MaxSize 100#define MaxWidth 40typedef char ElemType;typedef struct node{ ElemType data;/*数据元素*/ struct node *lchild;/*指向左孩子*/ struct node *rch
2013-02-05 16:09:36 946
原创 !求二叉树中从根结点到叶子结点的路径
/*exp7-3.cpp*/#include#include#define MaxSize 100typedef char ElemType;typedef struct node{ ElemType data;/*数据元素*/ struct node *lchild;/*指向左孩子*/ struct node *rchild;/*指向右孩子*/}BTNod
2013-02-05 15:13:24 3525
原创 实现二叉树各种遍历算法
/*exp7-2.cpp*/#include#include#define MaxSize 100typedef char ElemType;typedef struct node{ ElemType data;/*数据元素*/ struct node *lchild;/*指向左孩子*/ struct node *rchild;/*指向右孩子*/}BTNod
2013-02-05 14:12:18 1269
原创 实现二叉树各种基本运算的算法
/*文件名:algo7-1.cpp*/#include #include #define MaxSize 100typedef char ElemType;typedef struct node{ ElemType data; /*数据元素*/ struct node *lchild; /*指向左孩子*/ struct node *rchild; /*
2013-02-01 20:11:14 2586
原创 停车管理程序
/*文件名:exp3-7.cpp*/#include #include #define N 3 /*停车场内最多的停车数*/#define M 4 /*候车场内最多的停车数*/#define Price 2 /*每单位停车费用*/typedef struct { int CarNo[N]; /*车牌号*/ int CarTime[N];
2013-02-01 20:01:22 994
原创 病人看病模拟程序
/*文件名:exp3-6.cpp*/#include #include typedef struct qnode{ int data; struct qnode *next;} QNode; /*链队结点类型*/typedef struct { QNode *front,*rear;} QuType; /*链队类型*/v
2013-02-01 19:57:29 2407 1
原创 实现迷宫问题的所有路径及最短路径程序
/*文件名:exp3-5.cpp*/#include #define M 6 /*行数*/#define N 6 /*列数*/#define MaxSize 100 /*栈最多元素个数*/int mg[M+1][N+1]={ /*一个迷宫,其四周要加上均为1的外框*/{1,1,1,1,1,1},{1,0,0,0,1,1},{1,0,1,0,0
2013-02-01 19:52:35 2029
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人