当前位置: 首页>>代码示例>>C++>>正文


C++ MinStack::pop方法代码示例

本文整理汇总了C++中MinStack::pop方法的典型用法代码示例。如果您正苦于以下问题:C++ MinStack::pop方法的具体用法?C++ MinStack::pop怎么用?C++ MinStack::pop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MinStack的用法示例。


在下文中一共展示了MinStack::pop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    MinStack stack;
    stack.push(10);
    stack.push(6);
    stack.push(10);
    stack.push(20);
    stack.push(8);
    stack.push(10);
    stack.push(10);
    stack.push(-110);
    stack.push(10);
    cout << stack.top() << endl;
    cout << stack.getMin() << endl;
    stack.pop();
    stack.pop();
    stack.pop();
    stack.pop();
    stack.pop();
    stack.pop();
    stack.pop();
    stack.pop();
    stack.pop();
    stack.pop();
    cout << stack.top() << endl;
    cout << stack.getMin() << endl;
    return 0;
}
开发者ID:eschwabe,项目名称:interview-practice,代码行数:28,代码来源:min_stack.cpp

示例2: main

int main ()
{
	MinStack m;
	m.push (2);
	m.push (2);
	m.push (3);
	m.push (5);
	cout<<m.getMin ()<<endl;
	cout<<m.top ()<<endl;
	
	m.pop ();
	cout<<m.getMin ()<<endl;
	cout<<m.top ()<<endl;
	m.push (1);
	//m.pop ();
	cout<<m.getMin ()<<endl;
	cout<<m.top ()<<endl;
	
	m.pop ();
	cout<<m.getMin ()<<endl;
	cout<<m.top ()<<endl;

	m.pop ();
	cout<<m.getMin ()<<endl;
	cout<<m.top ()<<endl;

	m.pop ();
	cout<<m.getMin ()<<endl;
	cout<<m.top ()<<endl;

	return 0;
}
开发者ID:TomeC,项目名称:leetCode,代码行数:32,代码来源:MinStack.cpp

示例3: main

int main()
{
	/*push(2147483646),push(2147483646),push(2147483647),top,pop,getMin,pop,getMin,pop,push(2147483647),
	top,getMin,push(-2147483648),top,getMin,pop,getMin*/
	MinStack ms;
    ms.push(2147483646);
	ms.push(2147483646);
	ms.push(2147483647);
	ms.top();
	ms.pop();
	ms.getMin();
	ms.pop();
	ms.getMin();
	ms.pop();
	ms.push(2147483647);
	ms.top();
	ms.getMin();
	ms.push(-2147483648);
	ms.top();
	ms.getMin();
	ms.pop();
	ms.getMin();	
		
	return 0;
}
开发者ID:pkuzw,项目名称:LeetCode-Zhao-Wei-,代码行数:25,代码来源:Min+Stack.cpp

示例4: main

int main() {
	MinStack m;
	m.push(3);
	m.push(2);
	m.push(1);
	cout << m.getMin() << endl;
	m.pop();
	cout << m.getMin() << endl;
	m.pop();
	cout << m.getMin() << endl;
	m.pop();

}
开发者ID:xingkungao,项目名称:LeetCode_solutions,代码行数:13,代码来源:min_stack.cpp

示例5: main

int main(){
	MinStack st;
	st.push(2);
	st.push(3);
	st.pop();
	st.push(1);
	st.push(6);
	st.pop();
	st.push(7);
	cout<<st.getMin()<<endl;

	system("pause");
}
开发者ID:hyfeng,项目名称:leetcode,代码行数:13,代码来源:min_stack.cpp

示例6: test_case_one

void test_case_one(){
    MinStack ms;
    ms.push(10);
    ms.push(20);
    ms.push(5);
    ms.push(15);
    ms.push(3);
    ms.push(6);
    ms.push(2);
    ms.push(1);
    cout << ms.get_min() << endl;
    cout << "Element : " << ms.pop() << endl;
    cout << ms.get_min() << endl;
    cout << "Element : " << ms.pop() << endl;
    cout << ms.get_min() << endl;
    cout << "Element : " << ms.pop() << endl;
    cout << ms.get_min() << endl;
    cout << "Element : " << ms.pop() << endl;
    cout << ms.get_min() << endl;
    cout << "Element : " << ms.pop() << endl;
    cout << ms.get_min() << endl;
    cout << "Element : " << ms.pop() << endl;
    cout << ms.get_min() << endl;
    cout << "Element : " << ms.pop() << endl;
    cout << ms.get_min() << endl;
    cout << "Element : " << ms.pop() << endl;
}
开发者ID:anshulmgupta,项目名称:test,代码行数:27,代码来源:Min_Stack.cpp

示例7: main

int main()
{
    MinStack ms;
    ms.push(2);
    ms.push(0);
    ms.push(3);
    ms.push(0);
    cout << ms.getMin() << endl;
    ms.pop();
    cout << ms.getMin() << endl;
    ms.pop();
    cout << ms.getMin() << endl;
    ms.pop();
    cout << ms.getMin() << endl;
    return 0;
}
开发者ID:python27,项目名称:AlgorithmSolution,代码行数:16,代码来源:MinStack.cpp

示例8: main

int main()
{
	int result;
	MinStack s;
	s.push(-10000);
	s.push(-9999);
	s.push(-9998);
	s.push(-9997);
	s.push(-9996);
	s.push(-9995);
	s.push(-9994);
	s.push(-9993);
	s.push(-9992);
	s.push(-9991);
	s.push(-9990);
	s.show();
	
	result = s.getMin();
	cout << "the getMin result = " << result << endl;
	
	result = s.top();
	cout << "the top result = " << result << endl;

	s.pop();
	s.show();
	return 0;
}
开发者ID:zwy001,项目名称:leetcode,代码行数:27,代码来源:min_vectorstack.cpp

示例9: main

int main()
{
	cout<<mymax(4, 5)<<endl;
	cout<<mymax(5.6,7.6)<<endl;
	cout<<mymax(5,6.7)<<endl;
	cout<<mymax(5.9,3)<<endl;
	if (5.6<5)
	{
		cout<<"yes"<<endl;
		/* code */
	}

	//Mystack<int> ms;
	//Mystack<int> ms = Mystack<int>();
	//ms.push(9)
	Mystack<int> *ms= new Mystack<int>();
	const Mystack<int> *mss=ms;
	ms->push(9);
	ms->push(0);
	ms->push(3);
	ms->print();
	mss->print();

	Mystack<int> ms1(*ms);
	ms1.print();

	Mystack<int> ms2=ms1;
	ms2.print();

	MinStack mins;
	mins.push(2147483646);
	mins.push(2147483646);
	mins.push(2147483647);
	cout<<mins.top()<<endl;
	mins.pop();
	cout<<mins.getMin()<<endl;
	mins.pop();
	cout<<mins.getMin()<<endl;
	mins.pop();
	mins.push(2147483647);
	cout<<mins.top()<<endl;
	cout<<mins.getMin()<<endl;
	return 0;
}
开发者ID:Louffy,项目名称:myLeetCode,代码行数:44,代码来源:templete.cpp

示例10: main

int main() {
	MinStack minStack;
	minStack.push(-2);
	minStack.push(0);
	minStack.push(-3);
	cout << minStack.getMin() <<  "--> Returns -3" << endl;
	minStack.pop();
	cout << minStack.top() << "--> Returns 0" << endl;
	cout << minStack.getMin() <<  "--> Returns -2" << endl;
}
开发者ID:eagle9,项目名称:palgo,代码行数:10,代码来源:shaun1.cpp

示例11: main

int main () {
    MinStack* obj = new MinStack();
    obj->push(0);
    obj->push(1);
    obj->push(0);
    obj->getMin();
    obj->pop();
    obj->getMin();
    return 0;
}
开发者ID:husterxsp,项目名称:leetcode,代码行数:10,代码来源:MinStack.cpp

示例12: MinStack

TEST(leetcode_155_min_stack, Basic)
{
    MinStack *minStack = new MinStack();
    minStack->push(-2);
    minStack->push(0);
    minStack->push(-3);
    EXPECT_EQ(-3, minStack->getMin());
    minStack->pop();
    EXPECT_EQ(0, minStack->top());
    EXPECT_EQ(-2, minStack->getMin());
}
开发者ID:duxins,项目名称:leetcode,代码行数:11,代码来源:155-min-stack.cpp

示例13: main

int main(){
    MinStack stack;
    stack.push(-2);
    stack.push(0);
    stack.push(-1);
    std::cout << stack.getMin() << std::endl;
    std::cout << stack.top() << std::endl;
    stack.pop();
    std::cout << stack.getMin() << std::endl;
    return 0;
}
开发者ID:lobalani,项目名称:algo,代码行数:11,代码来源:min-stack.cpp

示例14: Mymain

int Mymain()
{
    MinStack s;
    s.push(9000);
    cout << s.getMin() << endl;
    s.push(10);
    cout << s.getMin() << endl;
    s.pop();
    cout << s.getMin() << endl;
    s.push(50);
    cout << s.getMin() << endl;
    s.pop();
    cout << s.getMin() << endl;
    s.push(1);
    cout << s.getMin() << endl;
    s.pop();
    cout << s.getMin() << endl;
    s.pop();
    cout << s.getMin() << endl;
}
开发者ID:robling,项目名称:Leetcode,代码行数:20,代码来源:program.cpp

示例15: main

int main(void)
{
	MinStack engine;
	engine.push(-2);
	engine.push(0);
	engine.push(-1);
	cout << engine.getMin() << '\n';
	cout << engine.top() << '\n';
	engine.pop();
	cout << engine.getMin() << '\n';
	return 0;
}
开发者ID:CaptainCan,项目名称:Leetcode,代码行数:12,代码来源:155+LL.cpp


注:本文中的MinStack::pop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。