Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [100pts] Copy Queue.java (with iterator code!), PeekaQueue.java and Ex1.java from the notes for this lecture. Compile and run on the following inputs:
    ~/$ java Ex1
    who are who two are two ;
    success
    ~/$ java Ex1
    who are who three two are two ;
    failure
    Completely reimplement Queue (badly!) using an array of 1024 Strings rather than a linked list, and int indices head and tail. So for example, after some number of operations you might have

    ... where the head=2 and tail=4 values tell you that the elements in the queue are array[2], array[3] and array[4]. You may assume that no application using this implementation will enqueue more than 1024 Strings.
    Note: Be sure that, despite your complete reimplementation of class Queue, PeekaQueue.java and Ex1.java still work exactly as before, with no changes at all!
Turn In a printout of your source code and a screen capture of Ex1 executing on the two inputs shown above. This must use your new re-implemented version of Queue!