优先队列

 1 public class MyPriorityQueue<E extends Comparable>{
 2     private Heap<E> heap = new Heap<E>();
 3     
 4     public void enqueue(E newObject){
 5         heap.add(newObject);
 6     }
 7     
 8     public E dequeue(){
 9         return heap.remove();
10     }
11     
12     public int getSize(){
13         return heap.getSize();
14     }
15 }

 

posted @ 2013-11-12 14:46  soul390  阅读(94)  评论(0编辑  收藏  举报