Multiple stacks :
Print this page
 
  • Here only one single one-dimensional array (Q) is used to store multiple stacks.
  • B (i) denotes one position less than the position in Q for bottommost element of stacks i.
  • T (i) denotes the top most element of stack i.
  • m denotes the maximum size of the array being used.
  • n denotes the number of stacks.
 

We also assume that equal segments of array will be used for each stack.

Initially let B (i) = T (i) = [m/n]*(i-1) where 1<= i <= n.

Again we can have push or pop operations, which can be performed on each of these stacks .


Prev