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 $\text{top 1}$ and $\text{top 2}$ $(\text{top 1 < 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{“stack full”}$ is
-
$(\text{top 1} = \text{MAXSIZE} / 2)$ and $(\text{top 2} = \text{MAXSIZE} / 2 + 1)$
-
$\text{top 1} + \text{top 2} = \text{MAXSIZE}$
-
$(\text{top 1} = \text{MAXSIZE} / 2)$ or $(\text{top 2} = \text{MAXSIZE})$
-
$\text{top 1} = \text{top 2} - 1$