Deque

A Deque is a data structure comprised of two queues. This implementation has a front queue, which is a reversed array, and a back queue, which is an array. Operations at either end of the Deque have the same complexity as operations on the end of either array.

  • The front and back queues. The front queue is stored in reverse.

    Declaration

    Swift

    public var front, back: [Element]
  • Initialise an empty Deque

    Declaration

    Swift

    public init() { (front, back) = ([], []) }