![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
栈
testgirl1
这个作者很懒,什么都没留下…
展开
-
设计一个有getmin功能的栈
#include<stack> #include<iostream> using namespace std; class MyStack{ public: void push(int a) { if (MinStack.empty()){ MinStack.push(a); } else if (MinStack.top() >= a)...原创 2018-08-09 16:07:56 · 121 阅读 · 0 评论 -
利用递归和栈操作实现逆序一个栈
#include<stack> #include<iostream> using namespace std; int getAndRemoveLastElement(stack<int> &s)//获取栈底元素,并移除 //eg:从栈底到栈顶元素为1、2、3、4 执行在这个函数后,元素为2、3、4,函数返回为1 { ...翻译 2018-08-09 17:42:26 · 181 阅读 · 0 评论