1. Double-Ended Queues

Re-implement the dequeue from HW 3 so that it can handle an unbounded number of elements. Your dequeue should have the same interface as in HW 3, except that the constructor will no longer take a maximum size parameter, since there is no maximum size. You should probably use some form of linked list in your implementation. Your implementation will be judged on both correctness and efficiency. Submit (at least) three files (header, implementation, test program) as usual.

2. Sparse Arrays, take two

Recall the sparse arrays of HW 2. In that case we were interested in arrays of a very restricted form (all zeroes, followed by some numbers, followed by all zeroes). A more general (and useful) setting is an array where most elements are zero but the non-zero elements are allowed to appear anywhere. In this exercise you must implement a data structure for this scenario.

More specifically, implement a SparseArray data structure with the following properties: As usual, submit a header file, an implementation file and a test program.

Hint: You will probably want to implement this using some form of list to hold the elements the user writes.