Implementation of deque