| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/vatsalya1102/Algorithm/main/2StackInAnArray.cpp | [Back] [Original] |
#include
#include
using namespace std;
class twoStacks
{
int *arr;
int size;
int top1, top2;
public:
twoStacks(int n)
{
size = n;
arr = new int[n];
top1 = -1;
top2 = size;
}
void push1(int x)
{
if (top1 < top2 - 1)
{
top1++;
arr[top1] = x;
}
else
{
cout
| Web Proxy Viewer | New URL | Original Page |