problem set

  1. Write instance methods for the Queue class that implement the peek() and dequeue() operations. Each of the methods should throw an exception if the queue is empty
  2. Write instance methods that implement the pop() and isEmpty() operations of the Stack class. Have your pop() mathod throw an exception if the stack is empty
  3. Suppose tha items in a linl list are in non-decreasing order. Write the instance method simplify that deletes any duplicate entries from a list. If, for example, a list contains :
    2 3 3 3 5 8 8 9, after the method call, the list will contain: 2 3 5 8 9.
Check answers here