Homework 7: Priority Queues (due 4/05/2017)
For your seventh homework, you will implement priority queues, as a sorted circular array. You will create a Class ListPriorityQueue that implements the following Prioroty Queue Interface:
public interface PriorityQueue { public int removeSmallest(); public int insert(int elem); }
Requirements
- Your class should be named 'ListPriorityQueue'
- Your class should have a constructor which takes a single integer, the initial size of the circular list to create
- Your class should double the size of the array when an element is inserted into a full list, copying all of the data from the old array into the new array
- Inserting into a list of length n should take time O(n)
- removeSmallest from a list of length n should take time O(1)
Submission
Please place ListPriorityQueue.java into subversion under:https://www.cs.usfca.edu/svn/<username>/cs245/homework7/