Week 4: Exercises

1. Vector

Expand the Vector class that we begin writing in the lecture:

class Vector {
    double[] v;
    
    public Vector(params double[] v) {
        this.v = v;
    }

    
}

Add these elements:

2. Polynomials

Design and implement a C# class Polynomial representing a polynomial of a single variable. Your class should include the following:

3. Queue

Write a class Queue implementing a queue of integers. A queue should have an unlimited size. The Queue class should have these members:

All operations should run in O(1).

4. Double-Ended Queue

Write a class Deque implementing a double-ended queue of integers:

Your class should have these members:

All operations should run in O(1). In dequeueFirst() and dequeueLast(), you may assume that the queue is not empty.