Implementation of Deque.h