北京师范学数据结构教学资料 第3章——栈与队列 - 复件.ppt

北京师范学数据结构教学资料 第3章——栈与队列 - 复件.ppt

北京师范学数据结构教学资料 第3章——栈与队列 - 复件

* 优先级队列 (Priority Queue) 优先级队列 每次从队列中取出的是具有最高优先权的元素 如下表:任务优先权及执行顺序的关系 数字越小,优先权越高 * #include assert.h #include iostream.h #include stdlib.h template class E class PQueue { private: E *pqelements; //存放数组 int count; //队列元素计数 int maxPQSize; //最大元素个数 void adjust(); //调整 优先级队列的类定义 * public: PQueue(int sz = 50); ~PQueue() { delete [ ] pqelements; } bool Insert(E x); bool RemoveMin(E x); bool GetFront(E x); void MakeEmpty() { count = 0; } bool IsEmpty() const { return count == 0; } bool IsFull

文档评论(0)

1亿VIP精品文档

相关文档