Definition
An instance S of the parameterized data type stack<E> is a sequence of elements of data type E , called the element type of S . Insertions or deletions of elements take place only at one end of the sequence, called the top of S . The size of S is the length of the sequence, a stack of size zero is called the empty stack.
#include < LEDA/core/stack.h >
Creation
stack< E> | S | creates an instance S of type stack<E>. S is initialized with the empty stack. |
Operations
Implementation
Stacks are implemented by singly linked linear lists. All operations take time O(1) , except clear which takes time O(n) , where n is the size of the stack.