• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Data Structures | Stack | Question 8

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 (GATE CS 2004)

(A)

(top1 = MAXSIZE/2) and (top2 = MAXSIZE/2+1)

(B)

top1 + top2 = MAXSIZE

(C)

(top1= MAXSIZE/2) or (top2 = MAXSIZE)

(D)

top1= top2 -1

Answer

Please comment below if you find anything wrong in the above post
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!

Last Updated :
Share your thoughts in the comments