更新时间:2015-11-05 22:58:36浏览次数:1+次
定义:把数组从逻辑上看成是一个头尾相连的环。
下面几个图形象的给你解释一下循环队列
实现循环队列几个小操作操作:
间未使用。看上图)
模板抽象定义:
template <class T>
class SeqQueue:public Queue<T>
{ public:
SeqQueue(int mSize);
~SeqQueue(){ delete []q;}
bool IsEmpty() const;
bool IsFull() const;
bool Front(T& x)const;
bool EnQueue(T x);
bool DeQueue();
void Clear(){front=rear=0;}
private:
int front,rear;//定义对头队尾元素
int maxSize;
T *q;
};
相关资讯