Week 4: Exercises

1. Linked Stack

Write a class LinkedStack that implements a stack using a linked list. It should have these members:

2. Unique Stack

Write a class UniqueStack that subclasses LinkedStack, and ignores any attempt to push the same value that is at the top of the stack.

3. Dynamic Array

Write a class DynArray representing a dynamic (i.e. resizable) array of integers. It should have these members:

4. Auto Array

Write a class AutoArray that subclasses DynArray. It should have a single constructor:

Create an empty AutoArray with the given default value.

An AutoArray is like a DynArray, except that

5. Linked Queue

Write a class LinkedQueue that implements a queue using a linked list. It should have the following members:

6. Array-Based Queue

Write a class ArrayQueue that implements a queue using a circular array. The queue should have no size limit. The class should have these members: