一、PriorityQueue和Queue
- PriorityQueue<Integer> heap = newPriorityQueue<>(newmyCom());
- Queue<Integer> queue = newLinkedList<>();
class myCom implements Comparator<Integer>{
@Override
public int compare(Integer num1,Integer num2){
return num1 - num2;
}
}
PriorityQueue<Integer> heap = new PriorityQueue<>(new myCom());
Queue<Integer> queue = new LinkedList<>();