1. Adapted from Sahni, Chapter 10, Question 7 (a)-(c)

Write a cyclic block implementation of the double-ended queue (deque) ADT introduced in Practice Sheet 4.

Your implementation should contain the following methods:

  1. DequeCharCyclic(s): create an empty deque of size s.
  2. isEmpty(): return true iff the deque is empty, false otherwise.
  3. isFull(): return true iff the deque is full, false otherwise.
  4. pushLeft(c): add character c as the left-most character in the deque, or throw an Overflow exception if the deque is full.
  5. pushRight(c): add character c as the right-most character in the deque, or throw an Overflow exception if the deque is full.
  6. peekLeft(): return the left-most character in the deque, or throw an Underflow exception if the deque is empty.
  7. peekRight(): return the right-most character in the deque, or throw an Underflow exception if the deque is empty.
  8. popLeft(): remove and return the left-most character in the deque, or throw an Underflow exception if the deque is empty.
  9. popRight(): remove and return the right-most character in the deque, or throw an Underflow exception if the deque is empty.