functions for the Deque data type added as decribed in the assignment