0001 #include "PQ/PQ.h" //引入优先级队列ADT 0002 #include "List/List.h" //引入列表 0003 template <typename T> class PQ_List : public PQ<T>, public List<T> { //基于列表实现的优先级队列 0004 public: 0005 PQ_List() { } //默认构造 0006 PQ_List ( T* E, int n ) { while ( 0 < n-- ) insertAsFirst ( ( E[n] ) ); } //批量构造 0007 void insert ( T e ) { insertAsLast ( e ); } //直接将新元素插至队列末尾 0008 T getMax() { return selectMax()->data; } //取出优先级最高的元素 0009 T delMax() { return remove ( selectMax() ); } //删除优先级最高的元素 0010 }; //PQ_List