let n=10 size of array

indexing 1 to 10

//define the constant

Initialsize 0

Maxsize 11

let stack1 represent as x=0

let stack2 represent as x=1

initial value of top1=Initialsize;

initial value of top2=Maxsize;

push(int n,int x)

{

if(top1==(top2-1))

{

stack overflow

}

else

{

if(x==0)

{

stack[top]=x;

top++;

}

else

{

stack[top]=x;

top--;

}

}

}

int pop(int n,int x)

{

int p;

if(x==0)

{

if(top1==Initialsize)

{

stack1 is empty

return;

}

else

{

p= top1;

top1--;

}

}

else

{

if(top2==Maxsize)

{

stack2 is empty

return;

}

else

{

p= top2;

top2++;

}

}

}