摘要: 1、 2 3 4 阅读全文
posted @ 2019-08-15 21:00 aascn 阅读(149) 评论(4) 推荐(0) 编辑
摘要: 1. 创建 阅读全文
posted @ 2019-05-03 20:43 aascn 阅读(157) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; typedef struct node{ char data; struct node *lchild; struct node *rchild; }Node; void CreateTree(Node * &T){ char ch; ... 阅读全文
posted @ 2019-05-03 20:41 aascn 阅读(176) 评论(0) 推荐(0) 编辑
摘要: // 循环队列采用顺序存储,为了区分队头和队尾,从1号下标开始存储 // 队头队尾同时指向0号下标表示队空,队尾下标的下一个元素是队头的时候表示队满 // 可以设置front指向队头元素,rear指向队尾元素的下一个位置 // 或者设置front指向队头元素的下一个节点,rear指向队尾元素 // 本程序采用前一种,后一种在操作的时候略有不便 // 出队的时候front+1,入队的时候rear+... 阅读全文
posted @ 2019-05-03 20:35 aascn 阅读(166) 评论(0) 推荐(0) 编辑
摘要: #include #include #define ERROR 1e5 typedef struct Node { int Element; struct Node *next, *last; }*PtrToNode; typedef struct DequeRecord { struct Node *front, *rear; }*Deque; typede... 阅读全文
posted @ 2019-05-03 20:35 aascn 阅读(337) 评论(0) 推荐(0) 编辑
摘要: // 带头节点的链式存储队列 #include #include typedef struct node{ int data; struct node * next; }QNode; typedef struct queue{ QNode *front; QNode *rear; }Queue; void initQueue(Queue *Q){ ... 阅读全文
posted @ 2019-05-03 20:33 aascn 阅读(161) 评论(0) 推荐(0) 编辑
摘要: // 队列的顺序存储 // 队空:front=rear=0 // 入队:rear+1 // 出队:front+1 // 该数组无头元素,出队入队都向上。 // 会产生假溢出,即rear=MAXSIZE且元素未填满队列时。 // 如何判断真正的上溢出?rear=MAXSIZE & rear!=0 // 扩展:区分真假溢出,如果是假溢出,可以reset一下。 // 但是如果数据量大,reset或不能... 阅读全文
posted @ 2019-05-03 20:32 aascn 阅读(126) 评论(0) 推荐(0) 编辑
摘要: #include #include typedef struct _Node{ char data; struct _Node *next; }Node; typedef struct _Stack{ Node * top; }Stack; void initStack(Stack *s){ s->top = (Node*)malloc(sizeof(... 阅读全文
posted @ 2019-05-03 20:30 aascn 阅读(114) 评论(0) 推荐(0) 编辑
摘要: #include #include #define MaxSize 50 // 顺序栈同数组,下标是从0开始,第一个元素占据0号位置,栈空为top=-1,栈满是MaxSize-1 // 记住顺序存储的存储结构。注意有top标记和元素数组 // 关键操作:1.判空(S->top=-1),判满(top=MaxSize-1);2.S->data[++S->top]=e // 一般return的原... 阅读全文
posted @ 2019-05-03 20:28 aascn 阅读(147) 评论(0) 推荐(0) 编辑
摘要: // 该程序使用带头结点的双向循环链表 // 交换节点进行排序 //补充:locate & Insert #include #include typedef struct _Node{ int data; struct _Node *next; struct _Node *prior; }DNode; DNode *createList(){ DNod... 阅读全文
posted @ 2019-05-03 20:26 aascn 阅读(168) 评论(0) 推荐(0) 编辑