A single array $A[1 \ldots \text{MAXSIZE}]$ is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables $top1$ and $top2$ $(top1 < top 2)$ point to the location of the topmost element in each of the stacks. If the space is to be used efficiently, the condition for $\text{“}\textsf{stack full}\text{”}$ is
-
$(top1 = \text{MAXSIZE} / 2)$ and $(top2 = \text{MAXSIZE} / 2 + 1)$
-
$top1 + top2 = \text{MAXSIZE}$
-
$(top1 = \text{MAXSIZE} / 2)$ or $(top2 = \text{MAXSIZE})$
-
$top1 = top2 - 1$