← back to the schedule


Queues MINI-LAB

By Autumn C. Spaulding with Alyce Brady


A Queue Interface, and an Implementation

Read through the K_Queue interface, a simplified version of the standard Java Queue interface that specifies four methods: isEmpty, enqueue, dequeue, and peekNext. Become familiar with the descriptions of these methods.

Now think about implementing a class that implements the K_Queue interface with O(1) performance for all four methods.

Analysis Question:

  • Consider the following data structures. Which ones could be used as the internal data representation for a K_Queue implementation with the performance characteristics described above?
    • a Java array?
    • an ArrayList object?
    • a LinkedList object?
  • Which do you think would be easiest to implement?

(Continue to Implementation Stage 1)


(Continue to Implementation Stage 2)


(Continue to Implementation Stage 3)


Submit your completed program through Kit, under Queue Mini-Lab.

Have fun! And if you have any questions remember I am available through email, Teams, and my office hours. And don't forget the Collaboration Center, which is a great place to work and ask questions too!



← back to the schedule