Return to Snippet

Revision: 36614
at November 24, 2010 03:56 by petspicko


Initial Code
struct qu { 
       kli vrijednosti;
       qu *sljedeci;
};
       
struct que { 
       qu *front, *rear; 
};

typedef struct que queue; 


kli FrontQ (queue *Q) { 
    return Q->front->sljedeci->vrijednosti; 
}

void EnQueueQ (kli x, queue *Q) { 
     qu* novi = new qu; 
     Q->rear->sljedeci=novi; 
     Q->rear = novi;  
   
     novi->vrijednosti = x; 
     novi->sljedeci = NULL; 
}

void DeQueueQ (queue *Q) { 
     qu* tekuci = Q->front;
     Q->front = tekuci->sljedeci;
     delete tekuci; 
} 

queue* InitQ (queue *Q) { 
       Q = new queue; 
       qu* novi = new qu; 
 
       Q->front = novi; 
       Q->rear = novi; 
 
       Q->front->sljedeci = NULL; 
       return Q;
}

bool IsEmptyQ (queue *Q) { 
     if (Q->front == Q->rear) return 1; 
     else return 0;  
}

Initial URL

                                

Initial Description

                                

Initial Title
strukture 3 red_pokazivac.h

Initial Tags

                                

Initial Language
C++