示例#1
0
文件: MaxPQ.java 项目: kinley/ads_3
 public Key max() {
   if (size == 0) {
     return null;
   } else {
     Key maximum = list.getFirst();
     for (Key p : list) {
       if (p.compareTo(maximum) == 1) maximum = p;
     }
     return maximum;
   }
 }
示例#2
0
文件: MaxPQ.java 项目: kinley/ads_3
 public Key delMax() {
   Key qurrentMax = list.pop(max);
   size--;
   max = this.max();
   return qurrentMax;
 }
示例#3
0
文件: MaxPQ.java 项目: kinley/ads_3
  public void insert(Key key) {

    list.push(key);
    size++;
    max = this.max();
  }