Question: Implement a priority queue as a linked list based data structure using provided Node class below. LinkedPriorityQueue class 1. Fields: An array of nodes named

Implement a priority queue as a linked list based data structure using provided Node class below.

LinkedPriorityQueue class 1. Fields: An array of nodes named rears; stores the tail of the priority groups as subarrays; if a priority group is empty, its rear reference is null. front; the head reference of the entire linked list

Constructor initializes rear array

*******************************************

Would really just like help with the constructor and the overall layout of the class. Confused by the rears array of nodes. Please do not use

any of Java's built in classes (LinkedList class, LinkedQueue, Queue interface, PriorityQueue class...etc)

*******************************************

MY NODE CLASS

public class Node implements Cloneable {

private String data;

private Node link;

public Node getLink() {

// reference to node after this node

return link;

}

public String getData() {

return data;

}

public void setData(String newData) {

data = newData;

}

public Node( String initialData, Node initialLink) {

data = initialData;

link = initialLink;

}

public Node addNodeAfter(String element) {

link = new Node(element, link);

return link;

}

}

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!