edited by
482 views
0 votes
0 votes

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

  1. $(\text{top 1} = \text{MAXSIZE} / 2)$ and $(\text{top 2} = \text{MAXSIZE} / 2 + 1)$

  2. $\text{top 1} + \text{top 2} = \text{MAXSIZE}$

  3. $(\text{top 1} = \text{MAXSIZE} / 2)$ or $(\text{top 2} = \text{MAXSIZE})$

  4. $\text{top 1} = \text{top 2} - 1$

edited by

Please log in or register to answer this question.

Answer:

Related questions

1 votes
1 votes
0 answers
4
soujanyareddy13 asked Apr 12, 2022
897 views
Match the following:$$\begin{array} {ll} \qquad \quad\textbf{List-I} & \qquad \quad \textbf{List-II} \\ \text{(P) Condition coverage} & \text{(1) Black-box testing} \\ \t...