A container is a sequential abstract data type that behaves like a black box where following rules have to be obeyed:
How values are added to container tail:
Although, as an abstract data type, container comes with no implementation, it requires from data structures that implement it to provide support for a minimal set of operations:
| Operation | Arguments | Returns | Description |
| clear | void | Clears container of all values. | |
| size | ULONG | Gets container size | |
| isEmpty | bool | Checks if container is empty | |
| push | VALUE | void | Pushes value to head @ stack or tail @ queue. |
| peek | VALUE | Gets value in container head @ stack or tail @ queue. | |
| pop | VALUE | Removes entry in container head @ stack or tail @ queue and returns its value. |
Where:
Most common implementations of containers are:
Time complexity table using Big O Notation becomes:
| Operation | Stack | Queue |
| clear | O(N) | O(N) |
| size | O(1) | O(1) |
| isEmpty | O(1) | O(1) |
| push | O(1) | O(1) |
| peek | O(1) | O(1) |
| pop | O(1) | O(1) |