A single array A[1..MAXSIZE] is used to implement two stacks. The two stacks…
GATE · 2004 · CS
A single array A[1..MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables top1 and top2 (topl< 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 “stack full” is
- A.
(top1 = MAXSIZE/2) and (top2 = MAXSIZE/2+1)
- B.
top1 + top2 = MAXSIZE
- C.
(top1= MAXSIZE/2) or (top2 = MAXSIZE)
- D.
top1= top2 -1
Attempted by 1082 students.
Sign up free to check your answer
Sign up freeLoading lesson…