```#include using namespace std;const int MAXSIZE = 1000;typedef int ELEMTYPE;const int N = 10;typedef struct { ELEMTYPE data[MAXSIZE]; int head; int ... ...
分类:
编程语言 时间:
2016-05-13 12:10:30
阅读次数:
136
循环队列的初始化、入队、出队等基本操作,实现代码如下:#include<iostream>usingnamespacestd;#defineTRUE1#defineFALSE0//循环队列的类型定义#defineMAXSIZE50//队列的最大长度typedefstruct{ intelement[MAXSIZE];//队列的元素空间 intfront;//头指针指示器 intrear;..
分类:
其他好文 时间:
2016-05-13 04:46:30
阅读次数:
495
第一种:顺序表#include
#include
#define MAXSIZE 20typedef struct{
int data[MAXSIZE];
int len;
}SqList;SqList * initSqList(){
SqList * L;
L = (SqList *)malloc(sizeof(SqList...
分类:
其他好文 时间:
2016-05-12 21:35:29
阅读次数:
175
#include
#include
#define MaxSize 100
using namespace std;
typedef struct node
{
char data;
struct node *lchild;
struct node *rchild;
} BTNode;
void CreateBTNode(BTNode *&b,char *str)
{
...
分类:
其他好文 时间:
2016-05-12 21:18:15
阅读次数:
232
1>//栈是先进后出,后进先出的线性表 简称LIFO线性表
//栈的顺序存储结构成为顺序栈(sequebtial stack).
//顺序栈利用一组地址连的存储单元依次存放从栈底到 栈顶的数据元素,通常用一维数组存放栈的元素
//”指针”top并非指针,而是表示栈顶元素的当前位置
//top不是指针型变量而是整形变量,top=0空栈,top=MaxSize 表示满栈,当top>ma...
分类:
其他好文 时间:
2016-05-12 19:02:20
阅读次数:
256
第一次在C++中写类,新手,见笑 #include<iostream.h>#include<iostream>template<typename T> class Queue{private: int maxsize,front,rear; T *q;public: Queue() { q=new ...
分类:
编程语言 时间:
2016-05-11 17:53:37
阅读次数:
125
以下是两种实现:
// Model One
const int MAXSIZE = 500010;
int rank[MAXSIZE]; // 节点高度的上界
int parent[MAXSIZE]; // 根节点
int FindSet(int x){ // 查找+递归的路径压缩...
分类:
其他好文 时间:
2016-05-09 07:04:41
阅读次数:
204
//定义数据类型 #define MAXSIZE = 100; #define OK 1; #define ERROR 0; typedef int status; typedef int ElemType; //平衡二叉排序树的结构 typedef struct Tnode { ElemType ...
分类:
编程语言 时间:
2016-05-07 06:35:48
阅读次数:
320
线性表存储 1.利用数组顺序存储 需要两个,一个是他存放的是什么,还有一个是指向最后一位的指针。 顺序表有动态分配和静态分配 静态分配: #define MaxSize 50 typedef struct { ElemType data[MaxSize]; int length; } 动态分配: # ...
分类:
其他好文 时间:
2016-05-03 23:28:20
阅读次数:
138
#define_CRT_SECURE_NO_WARNINGS1
#include<iostream>
usingnamespacestd;
#include<assert.h>
#defineMAXSIZE100
typedefintDataType;
typedefstructSeqList
{
DataType_array[MAXSIZE];
size_t_size;
}SeqList;
voidInitSeqList(SeqList*pSeq)
{
assert(pS..
分类:
编程语言 时间:
2016-05-01 17:52:59
阅读次数:
350