Stacks are declared as an "abstract" class. They are currently
implemented in any of three ways.
implement fixed sized stacks via arrays.
implement dynamically-sized stacks via XPlexes.
implement dynamically-size stacks via linked lists.
All possess the same capabilities. They differ only in constructors.
VStack constructors require a fixed maximum capacity argument. XPStack
constructors optionally take a chunk size argument. SLStack
constructors take no argument.
Assume the declaration of a base element `x'.
`Stack s; or Stack s(int capacity)'
declares a Stack.
returns true if stack s is empty.
returns true if stack s is full. XPStacks and SLStacks never
returns the current number of elements in the stack.
pushes x on stack s.
`x = s.pop()'
pops and returns the top of stack
returns a reference to the top of stack.
pops, but does not return the top of stack. When large items are
held on the stack it is often a good idea to use `top()' to
inspect and use the top of stack, followed by a `del_top()'
removes all elements from the stack.
Next: Queue Prev: Plex Up: Top
[ Dokumentation lokal installierter Software ]