Page 1 of 1

CODE IN JAVA Implement a priority queue capable of holding objects of an arbitrary type, T, by defining a PriorityQueue

Posted: Thu May 26, 2022 9:06 am
by answerhappygod
CODE IN JAVA
Implement a priority queue capable of holding objects of an
arbitrary type, T, by defining
a PriorityQueue class that implements
the queue with an ArrayList.
A priority queue is a type if list where every item added to the
queue also has an associated priority.
Define priority in your application so that those items with the
largest numerical value have the highest priority.
Your class should support the following methods:
輸入
輸出
範例說明
限制
繳交範例
​import java.util.*;
public class Main{
public static void main(String[] args) {
PriorityQueue q=new
PriorityQueue();
}
}
class PriorityQueue
{
/*add()*/
/*remove()*/
/*clear()*/
/*show()*/
}