Question: Starter Code Java Project public class PQueue > implements PQueueAPI { / * * * A complete tree stored in an array list representing the

Starter Code Java Project
public class PQueue> implements PQueueAPI
{
/**
* A complete tree stored in an array list representing the
* binary heap
*/
private ArrayList tree;
/**
* A comparator lambda function that compares two elements of this
* heap when rebuilding it; cmp.compare(x,y) gives 1. negative when x less than y
*2. positive when x greater than y 3.0 when x equal y
*/
private Comparator cmp;
/**
* Constructs an empty PQueue using the compareTo method of its data type as the
* comparator
*/
public PQueue()
{
//implement this method
}
/**
* A parameterized constructor that uses an externally defined comparator
* @param fn - a trichotomous integer value comparator function
*/
public PQueue(Comparator fn)
{
// implement this method
}
public boolean isEmpty()
{
// implement this method
return false;
}
public void insert(E obj)
{
//implement this method
}
public E remove() throws PQueueException
{
//implement this method
return null;
}
public E peek() throws PQueueException
{
//implement this method
return null;
}
public int size()
{
//implement this method
return 0;
}
/**
* Swaps a parent and child elements of this heap at the specified indices
* @param place an index of the child element on this heap
* @param parent an index of the parent element on this heap
*/
private void swap(int place, int parent)
{
//implement this method
}
/**
* Rebuilds the heap to ensure that the heap property of the tree is preserved.
* @param root the root index of the subtree to be rebuilt
* @param eSize the size of this tree
*/
private void rebuild(int root, int eSize)
{
//implement this method
}
}
* A application to simulate a non-preemptive scheduler for a single-core CPU
* using a heap-based implementation of a priority queue
* @see PQueue.java, PCB.java
*

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 Programming Questions!