Return to Snippet

Revision: 36615
at November 24, 2010 03:57 by petspicko


Initial Code
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;  
}

Initial URL

                                

Initial Description

                                

Initial Title
strukture 3 red_polje.h

Initial Tags

                                

Initial Language
C++