As usual, we will start by declaring the Deque class and its constructor:
class Deque { constructor() { this.count = 0; this.lowestCount = 0; this.items = {}; }}
Since a deque is a special queue, we will notice that it shares some code snippets with the constructor, the same internal properties, and the following methods: isEmpty, clear, size, and toString.
Since the deque allows inserting and removing from both ends, we will also have the following methods:
- addFront(element): This method adds a new element at the front of the deque
- addBack(element): This method adds a new element at the back of the deque (same implementation as the enqueue method from the Queue class)
- removeFront(): This method removes the first ...