Dequeue - A Double Ended Queue
Front Back
<- uncons --------- unsnoc -> cons -> --------- <- snoc
Based on the Bankers Double Ended Queue as described by C. Okasaki in "Purely Functional Data Structures"
A queue that allows items to be put onto either the front (cons) or the back (snoc) of the queue in constant time, and constant time access to the element at the very front or the very back of the queue. Dequeuing an element from either end is constant time when amortized over a number of dequeues.
This queue maintains an invariant that whenever there are at least two elements in the queue, neither the front list nor back list are empty. In order to maintain this invariant, a dequeue from either side which would leave that side empty constructs the resulting queue by taking elements from the opposite side
Attributes
- Companion
- object
- Source
- Dequeue.scala
- Graph
-
- Supertypes
Members list
Value members
Abstract methods
Attributes
- Source
- Dequeue.scala
Attributes
- Source
- Dequeue.scala
Attributes
- Source
- Dequeue.scala
Concrete methods
Append another Dequeue to this dequeue
alias for cons
alias for snoc
Attributes
- Source
- Dequeue.scala
enqueue to the front of the queue
Attributes
- Source
- Dequeue.scala
Attributes
- Source
- Dequeue.scala
Attributes
- Source
- Dequeue.scala
Attributes
- Source
- Dequeue.scala
Attributes
- Source
- Dequeue.scala
enqueue on to the back of the queue
Attributes
- Source
- Dequeue.scala
Attributes
- Source
- Dequeue.scala
Attributes
- Source
- Dequeue.scala
destructure from the front of the queue
destructure from the back of the queue