Design and implement a C# class Deque<T>
that
implements a deque (i.e. a double-ended queue) using a
doubly-linked list. Your class should include the following:
A method to test if a deque is empty
Methods that can push or pop elements at either end of the deque. The pop methods should throw an exception if the deque is empty.
An indexer that returns the n-th element of the deque (in linear time)
An iterator that allows the caller to traverse the deque
using foreach
A method filter
that removes all elements for
which a given condition is false
A method ToArray
that converts a dequeue to an
array
Also write a subclass CountingDeque<T>
that
keeps track of the total number of values that have ever been pushed
to a deque. The subclass should include a read-only property
totalPushes
that returns this value.