/ Published in: C++

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
struct qu { kli vrijednosti[10000]; int front, rear; }; typedef struct qu queue; int AddOne(int n) { return((n+1)%10000); } kli FrontQ (queue *Q) { return Q->vrijednosti[Q->front]; } void EnQueueQ (kli x, queue *Q) { Q->rear = AddOne(Q->rear); Q->vrijednosti[Q->rear] = x; } void DeQueueQ (queue *Q){ Q->front = AddOne(Q->front); } queue* InitQ (queue *Q){ Q = new queue; Q->front = 0; Q->rear = 9999; return Q; } bool IsEmptyQ (queue *Q){ if( Q->front == AddOne(Q->rear) ) return true; return false; }
Comments
