随笔分类 - 数据结构
IT菜鸟一名,计算机专业,同时也喜欢,历史文学
摘要:类定义文件Platform.h 1 Platform.h 2 #ifndef PLATFORM_H 3 #define PLATFORM_H 4 const int QueueSize=20; 5 class Platform 6 { 7 friend void Sort(Platform H[], int k); 8 //Platform H[],为一个数组对象,每一个数组对象有一个队列 9 friend void Init(Platform H[], int k);10 public:11 Platform();12 ~Platform(){}13 void EnQu...
阅读全文
摘要:数据结构的一元多项式相加: 1 LinkAdd.h 2 #ifndef LINKADD_H 3 #define LINKADD_H 4 const int MaxSize=100; 5 struct elem 6 { 7 int coef; 8 int exp; 9 elem * next;10 };11 struct Node12 {13 int coef;14 int exp;15 };16 17 class LinkList18 {19 friend void Add(LinkList &, LinkList);20 public:21 LinkList(Node a[...
阅读全文
摘要:二叉树的操作有前序递归遍历,前序非递归遍历,中序递归遍历,中序非递归遍历,后序递归遍历,后序非递归遍历,层序遍历,递归打印叶子结点,非递归打印叶子结点。若一棵树的结构如下,它的前序遍历是ABD##E#F##CG###则对树的操作代码如下:类BiTree, 则bitree.h的代码如下: 1 #ifndef BITREE_H 2 #define BITREE_H 3 4 const int MaxSize = 100; 5 6 template 7 struct BiNode //二叉树的结点结构 8 { 9 T data;10 BiNode *lchild, *rchild;...
阅读全文

浙公网安备 33010602011771号