Question: Objective Using the skeleton class UnSortedPriorityQueueQueue provided, implement a queue abstract data type using only an unsorted priority queue and one additional integer instance variable.

Objective
Using the skeleton class UnSortedPriorityQueueQueue provided, implement a queue abstract data
type using only an unsorted priority queue and one additional integer instance variable. Analyze the BigO runtime of your implementation of the enqueue() and dequeue() methods.
Requirements
1. Your solution should use the textbook net.datastructures.UnSortedPriorityQueue
2. Skeleton classes and JUnit test cases are provided to support your implementation. These
skeletons should be implemented however additional methods may be required.
3. Implement proper error handling
4. The Big-O runtime of the enqueue() and dequeue() should be indicated in the code comments
Points
Points Method
2 public UnSortedPriorityQueueQueue constructor and body
3 public void enqueue(V value)
1 point for Big-O analysis
3 public V dequeue()
1 point for Big-O analysis
1 public V first()
1 public int size()
1 public b
import net.datastructures.UnsortedPriorityQueue;
/**
* An implementation of a queue using the an unsorted priority queue
* @param The type of content held in the queue
*/
public class UnSortedPriorityQueueQueue {
// You complete me.
/**
* Construct an initially empty queue
*/
public UnSortedPriorityQueueQueue(){
// You complete me.
}
/**
* Enqueue value onto the queue
* Big-O analysis: // You complete me.
*
* @param value The element to be pushed on to the queue
*/
public void enqueue(V value){
// You complete me.
}
/**
* Remove the `oldest` element from the queue
* Big-O analysis: // You complete me.
*
* @return The first element that was added to the queue.
*/
public V dequeue(){
// You complete me.
}
/**
* Look at but do not remove the `oldest` element from the queue
* @return The first element that was added to the queue.
*/
public V first(){
// You complete me.
}
/**
*
* @return The size of the stack
*/
public int size(){
// You complete me.
}
/**
*
* @return True if the stack is empty. False otherwise.
*/
public boolean isEmpty(){
// You complete me.
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!