问一下队列的模板

学术版

队列没有模板谢谢
by Siyuan @ 2018-02-25 22:08:32


我这个又丑又长的如何? ```cpp struct que{ int head,tail; int q[10001]; void build(){ head=0; tail=0; } bool emp(){ return head==tail; } void push(int x){ q[tail]=x; tail++; if(tail==10001)tail=0; } void pop(){ head++; if(head==10001)head=0; } int end(){ if(tail==0)return q[10000]; else return q[tail-1]; } int begin(){ return q[head]; } }; ```
by Running_Coder @ 2018-02-25 22:08:38


只有STL:queue
by Siyuan @ 2018-02-25 22:08:44


队列也可以手打啊 甚至有的时候queue还会慢一些
by _LiM @ 2018-02-25 22:11:14


queue<int> q;
by newbie314159 @ 2018-02-25 22:49:01


|