retagged by
581 views

1 Answer

5 votes
5 votes

Overflow condition for stack suggests that stack is full.

As mentioned in the questions , the stacks are arranged from left to right in a contiguous manner i.e. after stack S0 , say ends ,stack S1 begins.

So the ith stack is full if top of ith stack points to the last element of that stack and just after that the next stack contents begin i.e. we reach base address of next stack.

So if we have ith stack the condition for it to be full is that top[i] is just before base[i+1] i.e just before base address of (i+1)th stack 

Hence , the required condition is : Top[i] = Base[i+1] - 1

Hence , C) should be the correct option.

If asked for underflow , i.e. stack is empty , in that case , Top[i] = Base[i] - 1

Related questions

0 votes
0 votes
1 answer
1
Souvik33 asked Nov 2, 2022
840 views
Which data structure would be most appropriate to implement a collection of values with the following 3 characteristicsSingly link list with head and tail pointerDoubly l...
2 votes
2 votes
2 answers
3
jatin khachane 1 asked Dec 1, 2018
1,227 views
My doubt : What should we consider ^ operator as Bitwise XOR ? or Exponentiation