
数据结构
cvlab.yang
偶尔写写程序
展开
-
栈的数组实现
//栈的数组实现 //数组从1开始,栈S在S[]处存放栈顶位置 #include <iostream> #include <cstring> #define N 1000using namespace std;int STACK_EMPTY(int S[]) { if(S[0]==0) return true; else return false; }void PUSH(int S[原创 2017-07-24 22:24:00 · 172 阅读 · 0 评论 -
队列的数组实现
//队列的数组实现 //入队(ENQUEUE)时检查队列上溢,出队(DEQUEUE)时检查队列下溢 //head指向队头元素,tail指向队尾下一个新元素将要插入的位置 #include <iostream> #include <cstring> #include <stdlib.h> #include <stdio.h> #define N 1000using namespace std;int原创 2017-07-25 10:23:50 · 907 阅读 · 0 评论 -
双链表的操作
#include <iostream> #define NIL 0 using namespace std;struct list { int data; list *last; list *next; list(int data) { this->data=data; this->last=NIL; this-原创 2017-07-25 15:22:47 · 207 阅读 · 0 评论