For this exercise, a priority queue is defined as a queue of nodes that contain
ID: 3556311 • Letter: F
Question
For this exercise, a priority queue is defined as a queue of nodes that contain both generic data AND and an integer value representing priority. Within the LinkedList used to form the queue, nodes are inserted in sorted order BY PRIORITY. The enqueue method should insert every new node BEHIND every other node of lower priority, but IN FRONT of evey other node in the list that has the same or higher priority. This retains the first-in-first-out property for any given priority level.
Your solution should create a new PriorityQueue for String data with:
PriorityQueue<String> pq = new PriorityQueue<String();
If I wanted to enqueue the String
Explanation / Answer
My verion of creating priority queue with linked list. Use if it helps or else ignore..
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.