Saturday 29 October 2016

STL:<stack> container

For using stack container we have to include <stack> in our program.We already know that stack is last in first out system.Mainly stack has two operations 1.push operation & 2.pop operation.
There are 5 member functions in the <stack> container.They are:
Suppose x is a stack
1.x.push(value);//for inserting a value in stack.
2.x.pop();//for removing the top element.
3.x.top();returns the top element of the stack.
4.x.empty();returns a boolean value that the is empty or not.
5.x.clear();for removing the entire stack.

No comments:

Post a Comment

Kruskal Algorithm

Minimum Cost Spanning Tree By Kruskal Algorithm using priority_queue in c++ #include<bits/stdc++.h> using namespace std; typedef p...