Question: Java language using Priority interface provided below A class DWayHeap that implements a d-heap where d is the number of children for nonleaf nodes. Your

Java language using Priority interface provided below

A class DWayHeap that implements a d-heap where d is the number of children for nonleaf nodes. Your class should implement the same priority queue interface and it should use a contiguous array portion as in your first implementation. It should include an empty constructor and additional constructor that takes d as an argument, work correctly for any d greater than or equal to 2, and use d as the number of children for nodes.

priority queue interface:

/** * Base interface for priority queue implementations for doubles. Throw * exceptions as appropriate. */ public interface PriorityQueue { /** * Returns true if priority queue has no elements * * @return true if the priority queue has no elements */ public boolean isEmpty();

/** * Returns the number of elements in this priority queue. * * @return the number of elements in this priority queue. */ public int size();

/** * Returns the minimum element in the priority queue * * @return the minimum element * @throws EmptyPQException * if priority queue contains no elements */ public double findMin();

/** * Inserts a new element into the priority queue. Duplicate values ARE * allowed. * * @param x * element to be inserted into the priority queue. */ public void insert(double x);

/** * Removes and returns the minimum element from the priority queue. * * @return the minimum element * @throws EmptyPQException * if priority queue contains no elements */ public double deleteMin();

/** * Resets the priority queue to appear as not containing any elements. */ public void makeEmpty();

}

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!