题目
实现一个特殊的栈, 在实现栈的基本功能的基础上, 再实现返
回栈中最小元素的操作。
【要求】
1. pop、 push、 getMin操作的时间复杂度都是O(1)。
2. 设计的栈类型可以使用现成的栈结构。
分析
先放着,过后整理
代码
// 获得栈中最小值操作.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
#include<stack>
using namespace std;
class Stack
{
public:
int getmin();
void push(int element);
int pop();
int size();
int top();
private:
stack<