Multiple stacks :
Print this page
 

Algorithms

Push (i, x)   Pop (i,x)
{ {
if ( T(i) = = B(i) )
If (((i<n) && (T(i)==B(i+1)) || ((i>=n) && (T(i) ==m)));   
Then print that the stack is empty.
Else
Then call STACK_FULL ; {
Else x = Q[T(i)];
{
T[i] = T[i] – 1;
T(i) = T(i) + 1; }
Q[T(i)] = x ;  }
}
}
 
Prev