Double Ended (DE) Queue

  • A Double Ended Queue is a data structure where you can insert or delete elements from either end

  • The operations on a Deque are:

    • addFirst(x): insert x at the front of the Deque

    • addLast(x): insert x at the tail of the Deque

    • removeFirst(x): remove the element at the front of the Deque and return it.

    • removeLast(x): insert the element at the tail of the Deque and return it.

  • Comment:

    • A Double Ended Queue can work/operate like a stack... how?

    • A Double Ended Queue can also work/operate like a queue... how?

The Deque data structure can be implemented with a circular buffer --- assignment