http://docs.oracle.com/javase/6/docs/api/java/util/Priority Queue.html” rel=“nofollow”Priority Queue
::
import java.util.*;
public class TryME {
public static void main(String args[]) {
PriorityQueue<Integer> q = new PriorityQueue<Integer>();
q.add(3);
System.out.print(q);
System.out.print("");
q.add(1);
System.out.print(q);
System.out.print("");
q.add(9);
System.out.print(q);
System.out.print("");
q.add(6);
System.out.print(q);
System.out.print("");
q.add(2);
System.out.print(q);
System.out.print("");
}
}
Output:
[3][1, 3][1, 3, 9][1, 3, 9, 6][1, 2, 9, 6, 3]
在什么基础上进行这种分类?