"Implement" usually means recording, clean and simple. Your teacher wants you to write code that can do what the assignment says.
Fixed-size stacks ( n) can easily be implemented as an array with the current stack depth, but you have an additional twist to your destination, as you are only stipulated to have elements non both stacks together and not every stack.
( , , ):
init_stack (sz):
allocate stack1 as array[1 to sz] of integer
allocate stack2 as array[1 to sz] of integer
set stack1sz to 0
set stack2sz to 0
set maxsz to sz
push_stack (stk,val):
if stk is not equal to 1 or 2:
return error
if stack1sz + stack2sz is equal to maxsz:
return error
if stk is 1:
add 1 to stack1sz
set element stack1sz of stack1 to val
else:
add 1 to stack2sz
set element stack2sz of stack2 to val
pop_statkck (stk):
if s is not equal to 1 or 2:
return error
if stk is 1:
if stack1sz is 0:
return error
set val to element stack1sz of stack1
subtract 1 from stack1sz
else:
if stack2sz is 0:
return error
set val to element stack2sz of stack2
subtract 1 from stack2sz
return val
stack1, stack2, stack1sz, stack2sz maxsz , (.. ). .
, , , .