Abstract datatype "Stack"
This functionality does not run in MATLAB.
adt::Stack implements the abstract data type
"Stack." To create a stack, an expression sequence of
any MuPAD® objects can be given to initialize the stack, otherwise
an empty stack is built.
S := adt::Stack() an empty stack is
built and assigned to the variable
All following methods change the value of
The stacks created in a session are named
Stack1, Stack2,... and
printed as such.
We create an empty stack, and fill it with some values:
S := adt::Stack(); S::push(a): S::push(b): S::push(c):
The stack now contains 3 elements:
The top of the stack is the last valued pushed:
Now, we fetch successively the values contains in
they come back in reversed order:
S::pop(); S::pop(); S::pop()
Now, the stack is empty. Trying to pop again an element from
it results in a
An expression sequence of objects to initialize the stack
Object of the domain