Reference
Queue
New
| Input | A list of elements. |
| Output | A queue containing the list of elements with the first element at the beginning of the queue. |
Signature
Example
Enqueue
| Input | A queue and an element. |
| Output | A new queue with the element added to the end. |
Signature
Example
Dequeue
| Input | A queue. |
| Output | A new queue with the element at the beginning removed. |
Signature
Example
Peek
| Input | A queue. |
| Output | The element at the beginning of the queue. |
Signature
Example
Is Empty
| Input | A queue. |
| Output | True if the queue is empty, false otherwise. |
Signature
Example
Is Not Empty
| Input | A queue. |
| Output | True if the queue is not empty, false otherwise. |
Signature
Example
Length
| Input | A queue. |
| Output | The number of elements in the queue. |
Signature
Example
Reverse
| Input | A queue. |
| Output | A new queue with the elements in reverse order. |
Signature
Example