![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据与结构
等等机器
这个作者很懒,什么都没留下…
展开
-
栈和队列的使用(C++)
栈和队列,都是线性结构。 栈是后进先出 队列是先进后出 一、头文件 栈 #include<stack> 队列 #include<queue> 二、定义 栈 stack<type> s; 队列 queue<type> q; 三、函数 栈 1.s.empty();//如果栈s为空,返回true,否则返回false 2.s.size();//返回栈的长度 3.s.pop(); //栈顶元素出栈 4.s.push(x);//把x入栈 5.s.top()原创 2021-01-19 11:35:52 · 104 阅读 · 0 评论 -
顺序表与链式表(如何用类实现)
顺序表: #include<iostream> using namespace std; const int MAX_n = 1000; class Seqlist { public: Seqlist() { length = 0; } Seqlist(int ca[], int b) ; ~Seqlist() {} int Length() { return length; } int get(int i);//按位查找 int locate(int x);//按值查找 void原创 2020-10-09 21:20:59 · 305 阅读 · 0 评论