Problem1382--另类循环队列

1382: 另类循环队列

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 1
[Submit] [Status] [Web Board] [Creator:]

Description

如果用一个循环数组表示队列,并且只设队列头指针Front,不设尾指针Rear,而是另设Count记录队列中元素个数。请编写算法实现队列的入队和出队操作。 函数接口定义: bool AddQ( Queue Q, ElementType X ); ElementType DeleteQ( Queue Q ); 其中Queue结构定义如下: typedef int Position; typedef struct QNode *PtrToQNode; struct QNode { ElementType *Data;

Input

队列Q,需要插入的队列元素x

Output

队列Q,需要插入的队列元素x

Sample Input Copy

4
Del
Add 5
Add 4
Add 3
Del
Del
Add 2
Add 1
Add 0
Add 10
End

Sample Output Copy

Queue Empty
5 is out
4 is out
Queue Full
3 2 1 0

Source/Category